From 4f239a093a93c1ab9df4ed9c22329bb21742bdf3 Mon Sep 17 00:00:00 2001 From: Thomas Corbat Date: Thu, 10 Jul 2014 08:53:29 +0200 Subject: [PATCH] Cosmetics and refactoring related to commits of bug 84144 Signed-off-by: Thomas Corbat --- .../parser/tests/ast2/AST2CPPSpecTest.java | 14 --- .../core/parser/tests/ast2/AST2CSpecTest.java | 14 --- .../cdt/core/parser/tests/ast2/AST2Tests.java | 23 ++++- .../cdt/core/dom/ast/IASTUnaryExpression.java | 3 +- .../cdt/core/dom/ast/INodeFactory.java | 3 +- .../internal/core/dom/parser/ASTQueries.java | 39 +++++++- .../parser/AbstractGNUSourceCodeParser.java | 20 ++--- .../core/dom/parser/BacktrackException.java | 11 ++- .../internal/core/dom/parser/c/CVisitor.java | 87 +++++------------- .../dom/parser/cpp/semantics/CPPVisitor.java | 89 +++++-------------- .../lrparser/action/BuildASTParserAction.java | 4 +- 11 files changed, 121 insertions(+), 186 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java index e778847f82b..0e34a15f5b4 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java @@ -10,7 +10,6 @@ * Markus Schorn (Wind River Systems) * Sergey Prigogin (Google) * Nathan Ridge - * Anders Dahlberg (Ericsson) - bug 84144 *******************************************************************************/ package org.eclipse.cdt.core.parser.tests.ast2; @@ -1011,19 +1010,6 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { parse(getAboveComment(), ParserLanguage.CPP, true, 1); } - // void f() - // { - // // ... - // void* labelPtr; - // labelPtr = &&foo; - // goto *labelPtr; - // foo: - // return; - // } - public void test6_bug84144() throws Exception { - parse(getAboveComment(), ParserLanguage.CPP, true, 0); - } - // int foo(int i) // { // static int s = foo(2*i); // recursive call - undefined diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java index d8312b55782..9b8d7cea198 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java @@ -7,7 +7,6 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Anders Dahlberg (Ericsson) - bug 84144 *******************************************************************************/ package org.eclipse.cdt.core.parser.tests.ast2; @@ -1728,19 +1727,6 @@ public class AST2CSpecTest extends AST2SpecTestBase { buffer.append("}\n"); //$NON-NLS-1$ parseCandCPP(buffer.toString(), false, 0); } - - // void f() - // { - // // ... - // void* labelPtr; - // labelPtr = &&foo; - // goto *labelPtr; - // foo: - // return; - // } - public void test6_bug84144() throws Exception { - parseCandCPP(getAboveComment(), true, 0); - } /** [--Start Example(C 6.8.6.4-4): diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index f750a0fc606..c29e67c77e7 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -11,6 +11,7 @@ * Andrew Ferguson (Symbian) * Sergey Prigogin (Google) * Thomas Corbat (IFS) + * Anders Dahlberg (Ericsson) - bug 84144 *******************************************************************************/ package org.eclipse.cdt.core.parser.tests.ast2; @@ -150,9 +151,14 @@ public class AST2Tests extends AST2TestBase { } private void parseAndCheckBindings() throws Exception { + parseAndCheckBindings(false); + } + + private void parseAndCheckBindings(boolean useGnuExtensions) throws Exception { String code= getAboveComment(); - parseAndCheckBindings(code, C); - parseAndCheckBindings(code, CPP); + parseAndCheckBindings(code, C, useGnuExtensions); + parseAndCheckBindings(code, CPP, useGnuExtensions); + } protected IASTTranslationUnit parseAndCheckBindings(String code) throws Exception { @@ -7548,4 +7554,17 @@ public class AST2Tests extends AST2TestBase { public void testU8TokenAfterIfdef_429361() throws Exception { parseAndCheckBindings(); } + + // void f() + // { + // // ... + // void* labelPtr; + // labelPtr = &&foo; + // goto *labelPtr; + // foo: + // return; + // } + public void testExpressionLabelReference_84144() throws Exception { + parseAndCheckBindings(true); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java index ebd297d633a..f56abc6307e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java @@ -125,8 +125,7 @@ public interface IASTUnaryExpression extends IASTExpression { public static final int op_noexcept = 17; /** - * For GCC parsers, only. {@code op_labelReference} is used for &&label type - * expressions. + * For GCC parsers, only. {@code op_labelReference} is used for &&label type expressions. * @since 5.8 */ public static final int op_labelReference = 18; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/INodeFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/INodeFactory.java index b3ad6582b1f..d24f40150d5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/INodeFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/INodeFactory.java @@ -120,11 +120,10 @@ public interface INodeFactory { public IGCCASTAttributeSpecifier newGCCAttributeSpecifier(); public IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement); - + public IASTGotoStatement newGotoStatement(IASTName name); /** - * Note: Adding as separate function to avoid changing API. * @since 5.8 */ public IASTStatement newGotoStatement(IASTExpression expression); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTQueries.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTQueries.java index 55b707a3154..7397eddbe42 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTQueries.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTQueries.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2014 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,9 +16,12 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator; import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; +import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IArrayType; +import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.parser.util.ArrayUtil; import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor; @@ -124,7 +127,27 @@ public class ASTQueries { } return result; } - + + /** + * Searches for the function enclosing the given node. May return null. + */ + public static IBinding findEnclosingFunction(IASTNode node) { + while (node != null && !(node instanceof IASTFunctionDefinition)) { + node= node.getParent(); + } + if (node == null) + return null; + + IASTDeclarator dtor= findInnermostDeclarator(((IASTFunctionDefinition) node).getDeclarator()); + if (dtor != null) { + IASTName name= dtor.getName(); + if (name != null) { + return name.resolveBinding(); + } + } + return null; + } + /** * Extracts the active declarations from an array of declarations. */ @@ -183,4 +206,16 @@ public class ASTQueries { } while (descendant != null); return false; } + + protected static boolean isLabelReference(IASTNode node) { + boolean labelReference = false; + IASTNode parent = node.getParent(); + + if (parent instanceof IASTUnaryExpression) { + int operator = ((IASTUnaryExpression) parent).getOperator(); + labelReference = operator == IASTUnaryExpression.op_labelReference; + } + + return labelReference; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java index d73353a4811..d9b17cd83ec 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java @@ -1990,21 +1990,21 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { } protected IASTStatement parseGotoStatement() throws EndOfFileException, BacktrackException { - int startOffset = consume().getOffset(); // t_goto - IASTStatement goto_statement = null; - + int startOffset = consume(IToken.t_goto).getOffset(); + IASTStatement gotoStatement = null; + if (LT(1) == IToken.tSTAR) { - IASTExpression goto_label_name_expression = expression(); - goto_statement = nodeFactory.newGotoStatement(goto_label_name_expression); + IASTExpression gotoLabelNameExpression = expression(); + gotoStatement = nodeFactory.newGotoStatement(gotoLabelNameExpression); } else { - IASTName goto_label_name = identifier(); - goto_statement = nodeFactory.newGotoStatement(goto_label_name); + IASTName gotoLabelName = identifier(); + gotoStatement = nodeFactory.newGotoStatement(gotoLabelName); } - + int lastOffset = consume(IToken.tSEMI).getEndOffset(); - ((ASTNode) goto_statement).setOffsetAndLength(startOffset, lastOffset - startOffset); - return goto_statement; + ((ASTNode) gotoStatement).setOffsetAndLength(startOffset, lastOffset - startOffset); + return gotoStatement; } protected IASTStatement parseBreakStatement() throws EndOfFileException, BacktrackException { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/BacktrackException.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/BacktrackException.java index f0f465a5c05..aac191b59e3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/BacktrackException.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/BacktrackException.java @@ -72,7 +72,6 @@ public class BacktrackException extends Exception { length = l; } - /** * @return Returns the length. */ @@ -85,15 +84,15 @@ public class BacktrackException extends Exception { public int getOffset() { return offset; } - + @Override public Throwable fillInStackTrace() { - // Do nothing, performance optimization - return this; + // Do nothing, performance optimization + return this; } - + @Override public StackTraceElement[] getStackTrace() { - return EMPTY_STACK; + return EMPTY_STACK; } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java index 9521c60abbf..e9477db5a8c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java @@ -58,7 +58,6 @@ import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.IASTStatement; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTypeId; -import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IArrayType; import org.eclipse.cdt.core.dom.ast.IBasicType; import org.eclipse.cdt.core.dom.ast.IBasicType.Kind; @@ -106,7 +105,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding; import org.eclipse.cdt.internal.core.dom.parser.ProblemType; import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator; -import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPLabel; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; import org.eclipse.cdt.internal.core.parser.util.ContentAssistMatcherFactory; @@ -466,8 +464,7 @@ public class CVisitor extends ASTQueries { boolean labelReference = isLabelReference(parent); if (labelReference) { - IASTUnaryExpression expression = (IASTUnaryExpression) parent.getParent(); - binding = createLabelReferenceBinding(name, expression); + binding = createLabelReferenceBinding(name); } else if (parent instanceof CASTIdExpression) { binding = resolveBinding(parent); } else if (parent instanceof ICASTTypedefNameSpecifier) { @@ -608,55 +605,33 @@ public class CVisitor extends ASTQueries { } return null; } - - private static boolean isLabelReference(IASTNode node) { - boolean labelReference = false; - IASTNode parent = node.getParent(); - - if (parent instanceof IASTUnaryExpression) { - int operator = ((IASTUnaryExpression) parent).getOperator(); - labelReference = operator == IASTUnaryExpression.op_labelReference; - } - - return labelReference; - } - - private static IBinding createLabelReferenceBinding(IASTName name, IASTUnaryExpression expression) { - IBinding binding = null; - + private static IBinding createLabelReferenceBinding(IASTName name) { // Find function scope for r-value expression // void* labelPtr = &&foo; // foo: ^^^ // return - IScope scope = getContainingScope(name); - IASTInternalScope s = (IASTInternalScope) scope; - IASTNode node = s.getPhysicalNode(); - - while (node != null && !(node instanceof IASTFunctionDefinition)) { - node = node.getParent(); - } - - if (node != null) { - IASTFunctionDefinition definition = (IASTFunctionDefinition) node; - CASTFunctionDeclarator declarator = (CASTFunctionDeclarator) definition.getDeclarator(); - scope = declarator.getFunctionScope(); - - if (scope != null) { - binding = scope.getBinding(name, false); + IBinding binding = null; + IBinding enclosingFunction = findEnclosingFunction(name); + if (enclosingFunction instanceof IFunction) { + IFunction function = (IFunction) enclosingFunction; + IScope functionScope = function.getFunctionScope(); + if (functionScope != null) { + binding = functionScope.getBinding(name, false); if (!(binding instanceof ILabel)) { - binding = new CPPLabel(name); - ASTInternal.addName(scope, name); + binding = new CLabel(name); + ASTInternal.addName(functionScope, name); } - } - } - - if (binding == null) { - binding = new ProblemBinding(expression, IProblemBinding.SEMANTIC_BAD_SCOPE, - expression.getRawSignature().toCharArray()); - } - - return binding; + } + } + + if (binding == null) { + IASTNode parentExpression = name.getParent(); + binding = new ProblemBinding(parentExpression, IProblemBinding.SEMANTIC_BAD_SCOPE, + parentExpression.getRawSignature().toCharArray()); + } + + return binding; } /** @@ -1726,26 +1701,6 @@ public class CVisitor extends ASTQueries { return true; } - /** - * Searches for the function enclosing the given node. May return null. - */ - public static IBinding findEnclosingFunction(IASTNode node) { - while (node != null && !(node instanceof IASTFunctionDefinition)) { - node= node.getParent(); - } - if (node == null) - return null; - - IASTDeclarator dtor= findInnermostDeclarator(((IASTFunctionDefinition) node).getDeclarator()); - if (dtor != null) { - IASTName name= dtor.getName(); - if (name != null) { - return name.resolveBinding(); - } - } - return null; - } - /** * Searches for the first function, struct or union enclosing the declaration the provided * node belongs to and returns the binding for it. Returns null, if the declaration is not diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java index 2e32732f1e0..577570bb547 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java @@ -179,7 +179,6 @@ import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator; import org.eclipse.cdt.internal.core.dom.parser.Value; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFieldReference; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionCallExpression; -import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTIdExpression; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTranslationUnit; @@ -301,17 +300,16 @@ public class CPPVisitor extends ASTQueries { id.resolveBinding(); return name.getBinding(); } - + // GNU Goto label reference // // void* labelPtr = &&foo; <-- label reference // foo: // boolean labelReference = isLabelReference(parent); - + if (labelReference) { - IASTUnaryExpression expression = (IASTUnaryExpression) parent.getParent(); - return createLabelReferenceBinding(name, expression); + return createLabelReferenceBinding(name); } else if (parent instanceof IASTIdExpression) { return resolveBinding(parent); } else if (parent instanceof ICPPASTFieldReference) { @@ -389,53 +387,32 @@ public class CPPVisitor extends ASTQueries { return scope == inScope; } - private static boolean isLabelReference(IASTNode node) { - boolean labelReference = false; - IASTNode parent = node.getParent(); - - if (parent instanceof IASTUnaryExpression) { - int operator = ((IASTUnaryExpression) parent).getOperator(); - labelReference = operator == IASTUnaryExpression.op_labelReference; - } - - return labelReference; - } - - private static IBinding createLabelReferenceBinding(IASTName name, IASTUnaryExpression expression) { - IBinding binding = null; - + private static IBinding createLabelReferenceBinding(IASTName name) { // Find function scope for r-value expression // void* labelPtr = &&foo; // foo: ^^^ // return - IScope scope = getContainingScope(name); - IASTInternalScope s = (IASTInternalScope) scope; - IASTNode node = s.getPhysicalNode(); - - while (node != null && !(node instanceof IASTFunctionDefinition)) { - node = node.getParent(); - } - - if (node != null) { - IASTFunctionDefinition definition = (IASTFunctionDefinition) node; - CPPASTFunctionDeclarator declarator = (CPPASTFunctionDeclarator) definition.getDeclarator(); - scope = declarator.getFunctionScope(); - - if (scope != null) { - binding = scope.getBinding(name, false); + IBinding binding = null; + IBinding enclosingFunction = findEnclosingFunction(name); + if (enclosingFunction instanceof IFunction) { + IFunction function = (IFunction) enclosingFunction; + IScope functionScope = function.getFunctionScope(); + if (functionScope != null) { + binding = functionScope.getBinding(name, false); if (!(binding instanceof ILabel)) { - binding = new CPPLabel(name); - ASTInternal.addName(scope, name); + binding = new CPPLabel(name); + ASTInternal.addName(functionScope, name); } - } - } - - if (binding == null) { - binding = new CPPScope.CPPScopeProblem(expression, IProblemBinding.SEMANTIC_BAD_SCOPE, - expression.getRawSignature().toCharArray()); - } - - return binding; + } + } + + if (binding == null) { + IASTNode parentExpression = name.getParent(); + binding = new CPPScope.CPPScopeProblem(parentExpression, IProblemBinding.SEMANTIC_BAD_SCOPE, + parentExpression.getRawSignature().toCharArray()); + } + + return binding; } private static IBinding createBinding(IASTGotoStatement gotoStatement) { @@ -2532,26 +2509,6 @@ public class CPPVisitor extends ASTQueries { return t instanceof ICPPReferenceType && !((ICPPReferenceType) t).isRValueReference(); } - /** - * Searches for the function enclosing the given node. May return null. - */ - public static IBinding findEnclosingFunction(IASTNode node) { - while (node != null && !(node instanceof IASTFunctionDefinition)) { - node= node.getParent(); - } - if (node == null) - return null; - - IASTDeclarator dtor= findInnermostDeclarator(((IASTFunctionDefinition) node).getDeclarator()); - if (dtor != null) { - IASTName name= dtor.getName(); - if (name != null) { - return name.resolveBinding(); - } - } - return null; - } - /** * Searches for the function or class enclosing the given node. May return null. */ diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java index 422dfd265fe..3dae5e1e47b 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java @@ -7,7 +7,6 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Anders Dahlberg (Ericsson) - bug 84144 *******************************************************************************/ package org.eclipse.cdt.core.dom.lrparser.action; @@ -45,6 +44,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement; import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator; import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; +import org.eclipse.cdt.core.dom.ast.IASTGotoStatement; import org.eclipse.cdt.core.dom.ast.IASTIdExpression; import org.eclipse.cdt.core.dom.ast.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; @@ -598,7 +598,7 @@ public abstract class BuildASTParserAction extends AbstractParserAction { */ public void consumeStatementGoto() { IASTName name = createName(stream.getRuleTokens().get(1)); - IASTStatement gotoStat = nodeFactory.newGotoStatement(name); + IASTGotoStatement gotoStat = nodeFactory.newGotoStatement(name); setOffsetAndLength(gotoStat); astStack.push(gotoStat); }