Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2009-03-30 11:59:54 -0400
committerMike Kucera2009-03-30 11:59:54 -0400
commit8fe659c7a4d353e469c0518f4b19d0271584b5a5 (patch)
treec8353005ab3083e4ec6b6a33adfa527183468b3e /lrparser/org.eclipse.cdt.core.lrparser
parentdae94a218c53df561809280cd2d81dedf2a730de (diff)
downloadorg.eclipse.cdt-8fe659c7a4d353e469c0518f4b19d0271584b5a5.tar.gz
org.eclipse.cdt-8fe659c7a4d353e469c0518f4b19d0271584b5a5.tar.xz
org.eclipse.cdt-8fe659c7a4d353e469c0518f4b19d0271584b5a5.zip
partial fix for bug 252243 for LR parser
Diffstat (limited to 'lrparser/org.eclipse.cdt.core.lrparser')
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/BaseExtensibleLanguage.java2
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java10
2 files changed, 11 insertions, 1 deletions
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/BaseExtensibleLanguage.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/BaseExtensibleLanguage.java
index 68c1b53338..fc98093961 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/BaseExtensibleLanguage.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/BaseExtensibleLanguage.java
@@ -95,7 +95,7 @@ public abstract class BaseExtensibleLanguage extends AbstractLanguage {
ILanguage gppLanguage = getParserLanguage() == ParserLanguage.CPP ? GPPLanguage.getDefault() : GCCLanguage.getDefault();
gtu = gppLanguage.getASTTranslationUnit(reader, scanInfo, fileCreator, index, options, log);
- System.out.println("GPP AST:");
+ System.out.println(gppLanguage.getName() + " AST:");
ASTPrinter.print(gtu);
System.out.println();
}
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 f9fc228a45..e991a59871 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
@@ -433,13 +433,23 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
if(alternateExpr == null)
astStack.push(expr);
+ else if(isFunctionType(expr)) // bug 252243
+ astStack.push(alternateExpr);
else {
IASTNode ambiguityNode = createAmbiguousExpression(expr, alternateExpr);
setOffsetAndLength(ambiguityNode);
astStack.push(ambiguityNode);
}
}
+
+ private static boolean isFunctionType(IASTExpression expr) {
+ if(expr instanceof IASTTypeIdExpression) {
+ IASTTypeId typeId = ((IASTTypeIdExpression) expr).getTypeId();
+ return typeId.getAbstractDeclarator() instanceof IASTFunctionDeclarator;
+ }
+ return false;
+ }
/**

Back to the top