Replaced impossible instanceof check in ASTQueries:
authorThomas Corbat <tcorbat@hsr.ch>
Wed, 22 Jul 2015 06:50:11 +0000 (08:50 +0200)
committerThomas Corbat <tcorbat@hsr.ch>
Wed, 22 Jul 2015 06:54:14 +0000 (08:54 +0200)
It does not make sense for findTypeRelevantDeclarator to check whether
the innermost declarator (result) is of type IASTArrayModifier:
- There is no common subtype of IASTDeclarator and IASTArrayModifier.
- IASTArrayModifier are attached to IASTArrayDeclarators but they are
not resolved as nested declarators.
- Similar to the existence of pointer operators, the resolution of the
innermost type relevant declarator should stop at array declarators.

Change-Id: I9c3673f60a48245eb51ccc8cb94757b87abf0265
Signed-off-by: Thomas Corbat <tcorbat@hsr.ch>
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTQueries.java

index 018e8fb..6a484bc 100644 (file)
@@ -11,7 +11,7 @@
 package org.eclipse.cdt.internal.core.dom.parser;
 
 import org.eclipse.cdt.core.dom.ast.ASTVisitor;
-import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
+import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
 import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
 import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
 import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
@@ -117,7 +117,7 @@ public class ASTQueries {
                while (result.getPointerOperators().length == 0 
                                && !(result instanceof IASTFieldDeclarator)
                                && !(result instanceof IASTFunctionDeclarator)
-                               && !(result instanceof IASTArrayModifier)) {
+                               && !(result instanceof IASTArrayDeclarator)) {
                        final IASTNode parent= result.getParent();
                        if (parent instanceof IASTDeclarator) {
                                result= (IASTDeclarator) parent;