mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fix bug 102149 : [CCE] caused by simple C++ code
This commit is contained in:
parent
23bf7780e8
commit
1dfd3e2006
1 changed files with 13 additions and 2 deletions
|
@ -193,8 +193,19 @@ public class CPPVariable implements ICPPVariable, ICPPInternalBinding {
|
|||
*/
|
||||
public IType getType() {
|
||||
if( type == null ){
|
||||
IASTDeclarator dtor = (IASTDeclarator) ( (definition != null) ? definition.getParent() : declarations[0].getParent() );
|
||||
type = CPPVisitor.createType( dtor );
|
||||
IASTName n = null;
|
||||
if( definition != null )
|
||||
n = definition;
|
||||
else if( declarations != null && declarations.length > 0 )
|
||||
n = declarations[0];
|
||||
|
||||
if( n != null ){
|
||||
while( n.getParent() instanceof IASTName )
|
||||
n = (IASTName) n.getParent();
|
||||
IASTNode node = n.getParent();
|
||||
if( node instanceof IASTDeclarator )
|
||||
type = CPPVisitor.createType( (IASTDeclarator)node );
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue