Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2005-07-05 15:46:52 +0000
committerAndrew Niefer2005-07-05 15:46:52 +0000
commit1dfd3e2006204610db36185ad172387c0cfcbbd7 (patch)
tree05c578fcd6ae9be734237e0e9581471f3740deea
parent23bf7780e849c9744e7ef1a2a91e9a9121f37b56 (diff)
downloadorg.eclipse.cdt-1dfd3e2006204610db36185ad172387c0cfcbbd7.tar.gz
org.eclipse.cdt-1dfd3e2006204610db36185ad172387c0cfcbbd7.tar.xz
org.eclipse.cdt-1dfd3e2006204610db36185ad172387c0cfcbbd7.zip
fix bug 102149 : [CCE] caused by simple C++ code
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java
index 69a016a62be..710efe2d940 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java
@@ -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;
}

Back to the top