Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivian Kong2010-06-02 15:35:43 -0400
committerVivian Kong2010-06-02 15:35:43 -0400
commit0890f7c49e85b0981cb2621e0cb9e1539e47cb0d (patch)
tree4051afa4b0d69dfcd19c85bf8f6cfff82f93b342
parentc2d90006b59e68f91df9edca1c01ff3dac3266bc (diff)
downloadorg.eclipse.cdt-0890f7c49e85b0981cb2621e0cb9e1539e47cb0d.tar.gz
org.eclipse.cdt-0890f7c49e85b0981cb2621e0cb9e1539e47cb0d.tar.xz
org.eclipse.cdt-0890f7c49e85b0981cb2621e0cb9e1539e47cb0d.zip
Bug 315435 Fix the regression test failures in cdt70
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRDigraphTrigraphTests.java8
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/ParseHelper.java72
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g2
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g3
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java23
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java84
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/gnu/GPPBuildASTParserAction.java23
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPNoCastExpressionParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPNoFunctionDeclaratorParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPSizeofExpressionParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPTemplateTypeParameterParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gcc/GCCParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gcc/GCCSizeofExpressionParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gpp/GPPParser.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gpp/GPPSizeofExpressionParser.java6
-rw-r--r--xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/XlcExtensionsTest.java22
-rw-r--r--xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/base/XlcLRCPPTests.java9
-rw-r--r--xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/c/XlcCParser.java6
-rw-r--r--xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/cpp/XlcCPPParser.java6
25 files changed, 274 insertions, 68 deletions
diff --git a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRDigraphTrigraphTests.java b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRDigraphTrigraphTests.java
index cbd38557c7..fd6f81e894 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRDigraphTrigraphTests.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/LRDigraphTrigraphTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation 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
@@ -24,7 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
-import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
+import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
@@ -172,14 +172,14 @@ public class LRDigraphTrigraphTests extends TestCase {
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration)((IASTDeclarationStatement)statements[0]).getDeclaration();
IASTDeclarator declarator1 = decl1.getDeclarators()[0];
assertEquals("xy", declarator1.getName().toString());
- IASTLiteralExpression expr1 = (IASTLiteralExpression)((IASTInitializerExpression)declarator1.getInitializer()).getExpression();
+ IASTLiteralExpression expr1 = (IASTLiteralExpression)((IASTEqualsInitializer)declarator1.getInitializer()).getInitializerClause();
assertEquals(IASTLiteralExpression.lk_string_literal, expr1.getKind());
assertEquals("\"its all good\"", expr1.toString());
IASTSimpleDeclaration decl2 = (IASTSimpleDeclaration)((IASTDeclarationStatement)statements[1]).getDeclaration();
IASTDeclarator declarator2 = decl2.getDeclarators()[0];
assertEquals("ab", declarator2.getName().toString());
- IASTLiteralExpression expr2 = (IASTLiteralExpression)((IASTInitializerExpression)declarator2.getInitializer()).getExpression();
+ IASTLiteralExpression expr2 = (IASTLiteralExpression)((IASTEqualsInitializer)declarator2.getInitializer()).getInitializerClause();
assertEquals(IASTLiteralExpression.lk_string_literal, expr2.getKind());
assertEquals("\"its still good\"", expr2.toString());
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/ParseHelper.java b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/ParseHelper.java
index efccb1af6c..d21d7ab2ce 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/ParseHelper.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/ParseHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation 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
@@ -24,9 +24,12 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.parser.CodeReader;
+import org.eclipse.cdt.core.parser.FileContent;
import org.eclipse.cdt.core.parser.IScannerInfo;
+import org.eclipse.cdt.core.parser.IncludeFileContentProvider;
import org.eclipse.cdt.core.parser.ParserUtil;
import org.eclipse.cdt.core.parser.ScannerInfo;
+import org.eclipse.cdt.core.parser.tests.ast2.AST2BaseTest;
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
import org.eclipse.core.runtime.CoreException;
@@ -127,14 +130,15 @@ public class ParseHelper {
public static IASTTranslationUnit parse(char[] code, ILanguage lang, Options options) {
- CodeReader codeReader = new CodeReader(code);
- return parse(codeReader, lang, new ScannerInfo(), null, options);
+
+ return parse(FileContent.create(AST2BaseTest.TEST_CODE, code), lang, new ScannerInfo(), null, options);
}
/**
* TODO thats WAY too many parameters, need to use a parameter object, need to refactor the
* DOM parser test suite so that its a lot cleaner.
+ * @Deprecated
*/
public static IASTTranslationUnit parse(CodeReader codeReader, ILanguage language, IScannerInfo scanInfo,
ICodeReaderFactory fileCreator, Options options) {
@@ -185,13 +189,67 @@ public class ParseHelper {
return tu;
}
+
+ /**
+ * TODO thats WAY too many parameters, need to use a parameter object, need to refactor the
+ * DOM parser test suite so that its a lot cleaner.
+ */
+ public static IASTTranslationUnit parse(FileContent fileContent, ILanguage language, IScannerInfo scanInfo,
+ IncludeFileContentProvider fileContentProvider, Options options) {
+ testsRun++;
+
+ IASTTranslationUnit tu;
+ try {
+ int languageOptions = 0;
+ if(options.skipTrivialInitializers)
+ languageOptions |= ILanguage.OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS;
+
+ tu = language.getASTTranslationUnit(fileContent, scanInfo, fileContentProvider, null, languageOptions, ParserUtil.getParserLogService());
+ } catch (CoreException e) {
+ throw new AssertionFailedError(e.toString());
+ }
+
+ // should parse correctly first before we look at the bindings
+ if(options.checkSyntaxProblems) {
+
+ // this should work for C++ also, CVisitor.getProblems() and CPPVisitor.getProblems() are exactly the same code!
+ if (CVisitor.getProblems(tu).length != 0) {
+ throw new AssertionFailedError(" CVisitor has AST Problems " );
+ }
+ }
+
+ if(options.checkPreprocessorProblems) {
+ if (tu.getPreprocessorProblems().length != 0) {
+ throw new AssertionFailedError(language.getName() + " TranslationUnit has Preprocessor Problems " );
+ }
+ }
+
+ // resolve all bindings
+ if (options.checkBindings) {
+ NameResolver res = new NameResolver();
+ tu.accept( res );
+ if(res.problemBindings.size() != options.expectedProblemBindings)
+ throw new AssertionFailedError("Expected " + options.expectedProblemBindings + " problem(s), encountered " + res.problemBindings.size());
+
+ if(options.problems != null) {
+ for(int i = 0; i < options.problems.length; i++) {
+ String expected = options.problems[i];
+ String actual = res.problemBindings.get(i);
+ if(!expected.equals(actual))
+ throw new AssertionFailedError(String.format("Problem binding not equal, expected: %s, got: %s", expected, actual));
+ }
+ }
+ }
+
+ return tu;
+ }
public static IASTTranslationUnit commentParse(String code, ILanguage language) {
- CodeReader codeReader = new CodeReader(code.toCharArray());
+
IASTTranslationUnit tu;
try {
- tu = language.getASTTranslationUnit(codeReader, new ScannerInfo(), null, null, ILanguage.OPTION_ADD_COMMENTS, ParserUtil.getParserLogService());
+ tu = language.getASTTranslationUnit(FileContent.create(AST2BaseTest.TEST_CODE, code.toCharArray()), new ScannerInfo(), null, null, ILanguage.OPTION_ADD_COMMENTS, ParserUtil.getParserLogService());
} catch (CoreException e) {
throw new AssertionFailedError(e.toString());
}
@@ -204,9 +262,9 @@ public class ParseHelper {
public static IASTCompletionNode getCompletionNode(String code, ILanguage language, int offset) {
- CodeReader reader = new CodeReader(code.toCharArray());
+
try {
- return language.getCompletionNode(reader, new ScannerInfo(), null, null, ParserUtil.getParserLogService(), offset);
+ return language.getCompletionNode(FileContent.create(AST2BaseTest.TEST_CODE, code.toCharArray()), new ScannerInfo(), null, null, ParserUtil.getParserLogService(), offset);
} catch (CoreException e) {
throw new RuntimeException(e);
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g
index 7759f3a36d..2bee88b41a 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g
@@ -894,6 +894,8 @@ initializer
::= assignment_expression
/. $Build consumeInitializer(); $EndBuild ./
| initializer_list
+--CDT_70_FIX_FROM_50-#4
+ /. $Build consumeInitializer(); $EndBuild ./
initializer_list
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g
index 5bd75a6a96..76bb4a73da 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g
@@ -1293,7 +1293,8 @@ initializer_clause
::= assignment_expression
/. $Build consumeInitializer(); $EndBuild ./
| initializer_list
-
+--CDT_70_FIX_FROM_50-#4
+ /. $Build consumeInitializer(); $EndBuild ./
initializer_list
::= start_initializer_list '{' <openscope-ast> initializer_seq ',' '}' end_initializer_list
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 61da983fc9..364aee71da 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation 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
@@ -35,6 +35,7 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
+import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
@@ -44,7 +45,7 @@ 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.IASTInitializerExpression;
+import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
@@ -128,7 +129,7 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
public void initializeTranslationUnit(IScanner scanner, IBuiltinBindingsProvider builtinBindingsProvider, IIndex index) {
- tu = nodeFactory.newTranslationUnit();
+ tu = nodeFactory.newTranslationUnit(scanner);
tu.setIndex(index);
// add built-in names to the scope
@@ -1006,13 +1007,17 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
* initializer ::= assignment_expression
*/
public void consumeInitializer() {
- IASTExpression expr = (IASTExpression) astStack.pop();
- if(discardInitializer(expr)) {
- astStack.push(null);
- return;
+ //CDT_70_FIX_FROM_50-#4
+ IASTInitializerClause initClause = (IASTInitializerClause) astStack.pop();
+ if(initClause instanceof IASTExpression){
+ if(discardInitializer((IASTExpression)initClause)) {
+ astStack.push(null);
+ return;
+ }
}
-
- IASTInitializerExpression initializer = nodeFactory.newInitializerExpression(expr);
+ //CDT_70_FIX_FROM_50-#2
+ //IASTInitializerExpression initializer = nodeFactory.newInitializerExpression(expr);
+ IASTEqualsInitializer initializer = nodeFactory.newEqualsInitializer(initClause);
setOffsetAndLength(initializer);
astStack.push(initializer);
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java
index b9922fa014..a7ca0726c8 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation 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
@@ -28,11 +28,14 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
+import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
+import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
+import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.IASTName;
@@ -48,6 +51,7 @@ import org.eclipse.cdt.core.dom.ast.IASTSwitchStatement;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
+import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAmbiguousTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
@@ -97,6 +101,7 @@ import org.eclipse.cdt.core.dom.lrparser.action.ParserUtil;
import org.eclipse.cdt.core.dom.lrparser.action.ScopedStack;
import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym;
+import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousStatement;
@@ -104,6 +109,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguousDeclarator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguousExpression;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguousStatement;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguousTemplateArgument;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTConstructorInitializer;
import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
/**
@@ -296,9 +302,17 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
public void consumeExpressionSimpleTypeConstructor() {
IASTExpression expression = (IASTExpression) astStack.pop();
IToken token = (IToken) astStack.pop();
-
- int type = asICPPASTSimpleTypeConstructorExpressionType(token);
- ICPPASTSimpleTypeConstructorExpression typeConstructor = nodeFactory.newSimpleTypeConstructorExpression(type, expression);
+ ////CDT_70_FIX_FROM_50-#3
+ //int type = asICPPASTSimpleTypeConstructorExpressionType(token);
+ ICPPASTConstructorInitializer init=null;
+ if(expression!=null){
+ init = new CPPASTConstructorInitializer();
+ init.setExpression(expression);
+
+ ((ASTNode)init).setOffsetAndLength(((ASTNode)expression).getOffset(),((ASTNode)expression).getLength());
+ }
+ ICPPASTDeclSpecifier declspec = transformIntoSimpleTypeSpecifier(token);
+ ICPPASTSimpleTypeConstructorExpression typeConstructor = nodeFactory.newSimpleTypeConstructorExpression(declspec, init);
setOffsetAndLength(typeConstructor);
astStack.push(typeConstructor);
@@ -327,6 +341,35 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
}
}
+ private ICPPASTDeclSpecifier transformIntoSimpleTypeSpecifier(IToken token){
+ ICPPASTSimpleDeclSpecifier declspec= nodeFactory.newSimpleDeclSpecifier();
+ switch(baseKind(token)) {
+ case TK_char : declspec.setType(Kind.eChar); break;
+ case TK_wchar_t : declspec.setType(Kind.eWChar); break;
+ case TK_bool : declspec.setType(Kind.eBoolean);break;
+ case TK_short : declspec.setShort(true); break;
+ case TK_int : declspec.setType(Kind.eInt); break;
+ case TK_long : declspec.setLong(true); break;
+ case TK_signed : declspec.setSigned(true); break;
+ case TK_unsigned : declspec.setUnsigned(true); break;
+ case TK_float : declspec.setType(Kind.eFloat); break;
+ case TK_double : declspec.setType(Kind.eDouble); break;
+ case TK_void : declspec.setType(Kind.eVoid); break;
+
+ default:
+ assert false : "type parsed wrong"; //$NON-NLS-1$
+ declspec.setType(Kind.eUnspecified);
+ break;
+ }
+ ((ASTNode) declspec).setOffset(token.getStartOffset());
+ int ruleLength = token.getEndOffset() - token.getStartOffset();
+ ((ASTNode) declspec).setLength(ruleLength < 0 ? 0 : ruleLength);
+
+ return declspec;
+
+
+ }
+
/**
* postfix_expression
@@ -362,8 +405,9 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
IASTExpression expr = (IASTExpression) astStack.pop();
IASTDeclarator declarator = (IASTDeclarator) astStack.pop();
IASTDeclSpecifier declSpec = (IASTDeclSpecifier) astStack.pop();
-
- IASTInitializerExpression initializer = nodeFactory.newInitializerExpression(expr);
+ //CDT_70_FIX_FROM_50-#2
+ //IASTInitializerExpression initializer = nodeFactory.newInitializerExpression(expr);
+ IASTEqualsInitializer initializer = nodeFactory.newEqualsInitializer(expr);
ParserUtil.setOffsetAndLength(initializer, offset(expr), length(expr));
declarator.setInitializer(initializer);
@@ -1029,7 +1073,8 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
case TK_signed: n.setSigned(true); return;
case TK_unsigned: n.setUnsigned(true); return;
- case TK_long: n.setLong(true); return;
+ //if it is a longlong, donot set long, CDT_70_FIX_FROM_50-#8
+ case TK_long: if(!n.isLongLong()) n.setLong(true); return;
case TK_short: n.setShort(true); return;
}
}
@@ -1474,8 +1519,16 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
* ::= '(' expression_list ')'
*/
public void consumeInitializerConstructor() {
- IASTExpression expression = (IASTExpression) astStack.pop();
- ICPPASTConstructorInitializer initializer = nodeFactory.newConstructorInitializer(expression);
+ //CDT_70_FIX_FROM_50-#5
+ Object o = astStack.pop();
+ IASTInitializerClause[] initClauseList =null;
+ if(o instanceof IASTExpressionList){
+ initClauseList = ((IASTExpressionList) o).getExpressions();
+ }else if(o instanceof IASTInitializerClause){
+ initClauseList = new IASTInitializerClause[]{(IASTInitializerClause)o};
+ }
+
+ ICPPASTConstructorInitializer initializer = nodeFactory.newConstructorInitializer(initClauseList);
setOffsetAndLength(initializer);
astStack.push(initializer);
}
@@ -1566,8 +1619,10 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
List<Object> handlers = isTryBlockDeclarator ? astStack.closeScope() : Collections.emptyList();
IASTCompoundStatement body = (IASTCompoundStatement) astStack.pop();
List<Object> initializers = astStack.closeScope();
- IASTFunctionDeclarator declarator = (IASTFunctionDeclarator) astStack.pop();
- IASTDeclSpecifier declSpec = (IASTDeclSpecifier) astStack.pop(); // may be null
+ Object o = astStack.pop();
+ IASTFunctionDeclarator declarator = (IASTFunctionDeclarator) o;
+ Object o2 = astStack.pop();
+ IASTDeclSpecifier declSpec = (IASTDeclSpecifier) o2; // may be null
if(declSpec == null) { // can happen if implicit int is used
declSpec = nodeFactory.newSimpleDeclSpecifier();
@@ -1620,12 +1675,15 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
*/
public void consumeMemberDeclaratorWithInitializer() {
- IASTInitializerExpression initializer = (IASTInitializerExpression) astStack.pop();
+
+ //CDT_70_FIX_FROM_50-#2
+ //IASTInitializerExpression initializer = (IASTInitializerExpression) astStack.pop();
+ IASTEqualsInitializer initializer = (IASTEqualsInitializer) astStack.pop();
IASTDeclarator declarator = (IASTDeclarator) astStack.peek();
setOffsetAndLength(declarator);
if(declarator instanceof ICPPASTFunctionDeclarator) {
- IASTExpression expr = initializer.getExpression();
+ IASTExpression expr = (IASTExpression)initializer.getInitializerClause();
if(expr instanceof IASTLiteralExpression && "0".equals(expr.toString())) { //$NON-NLS-1$
((ICPPASTFunctionDeclarator)declarator).setPureVirtual(true);
return;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/gnu/GPPBuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/gnu/GPPBuildASTParserAction.java
index a108a0c7a6..a4d777a291 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/gnu/GPPBuildASTParserAction.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/gnu/GPPBuildASTParserAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2010 IBM Corporation 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
@@ -68,8 +68,9 @@ public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
// There's an expression somewhere on the stack, find it
IASTExpression expr = findFirstAndRemove(topScope, IASTExpression.class);
- IGPPASTSimpleDeclSpecifier declSpec = nodeFactory.newSimpleDeclSpecifierGPP();
- declSpec.setTypeofExpression(expr);
+ //CDT_70_FIX_FROM_50-#7
+ ICPPASTSimpleDeclSpecifier declSpec = nodeFactory.newSimpleDeclSpecifier();
+ declSpec.setDeclTypeExpression(expr);
// now apply the rest of the specifiers
for(Object token : topScope) {
@@ -102,15 +103,15 @@ public class GPPBuildASTParserAction extends CPPBuildASTParserAction {
}
}
}
-
- ICPPASTSimpleDeclSpecifier declSpec;
+ //CDT_70_FIX_FROM_50-#7
+ ICPPASTSimpleDeclSpecifier declSpec = nodeFactory.newSimpleDeclSpecifier();
if(isComplex || isImaginary || numLong > 1) {
- IGPPASTSimpleDeclSpecifier gppDeclSpec = nodeFactory.newSimpleDeclSpecifierGPP();
- gppDeclSpec.setComplex(isComplex);
- gppDeclSpec.setImaginary(isImaginary);
- gppDeclSpec.setLongLong(numLong > 1);
- gppDeclSpec.setLong(numLong == 1);
- declSpec = gppDeclSpec;
+ // IGPPASTSimpleDeclSpecifier gppDeclSpec = nodeFactory.newSimpleDeclSpecifierGPP();
+ declSpec.setComplex(isComplex);
+ declSpec.setImaginary(isImaginary);
+ declSpec.setLongLong(numLong > 1);
+ declSpec.setLong(numLong == 1);
+ //declSpec = gppDeclSpec;
}
else {
declSpec = nodeFactory.newSimpleDeclSpecifier();
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionParser.java
index 2bf14923a4..ff4a7f527b 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionParser.java
@@ -1168,6 +1168,12 @@ public C99ExpressionParser(ITokenStream stream, Map<String,String> properties) {
}
//
+ // Rule 283: initializer ::= initializer_list
+ //
+ case 283: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 284: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq comma_opt } end_initializer_list
//
case 284: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java
index 1e62f18226..b6b22f2f66 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java
@@ -1162,6 +1162,12 @@ public C99NoCastExpressionParser(ITokenStream stream, Map<String,String> propert
}
//
+ // Rule 282: initializer ::= initializer_list
+ //
+ case 282: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 283: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq comma_opt } end_initializer_list
//
case 283: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java
index d2ce4a2f29..731f2441e0 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java
@@ -1145,6 +1145,12 @@ public String getName() {
}
//
+ // Rule 283: initializer ::= initializer_list
+ //
+ case 283: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 284: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq comma_opt } end_initializer_list
//
case 284: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java
index 8f420627cd..7b47fc6940 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java
@@ -1162,6 +1162,12 @@ public C99SizeofExpressionParser(ITokenStream stream, Map<String,String> propert
}
//
+ // Rule 282: initializer ::= initializer_list
+ //
+ case 282: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 283: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq comma_opt } end_initializer_list
//
case 283: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionParser.java
index 238e9170c1..71bae636f8 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionParser.java
@@ -1565,6 +1565,12 @@ public CPPExpressionParser(ITokenStream stream, Map<String,String> properties) {
}
//
+ // Rule 383: initializer_clause ::= initializer_list
+ //
+ case 383: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 384: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq , } end_initializer_list
//
case 384: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPNoCastExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPNoCastExpressionParser.java
index 1b3191f787..abf24e58f6 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPNoCastExpressionParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPNoCastExpressionParser.java
@@ -1559,6 +1559,12 @@ public CPPNoCastExpressionParser(ITokenStream stream, Map<String,String> propert
}
//
+ // Rule 382: initializer_clause ::= initializer_list
+ //
+ case 382: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 383: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq , } end_initializer_list
//
case 383: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPNoFunctionDeclaratorParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPNoFunctionDeclaratorParser.java
index c574bbaae4..f0a60677a1 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPNoFunctionDeclaratorParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPNoFunctionDeclaratorParser.java
@@ -1559,6 +1559,12 @@ public CPPNoFunctionDeclaratorParser(ITokenStream stream, Map<String,String> pro
}
//
+ // Rule 381: initializer_clause ::= initializer_list
+ //
+ case 381: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 382: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq , } end_initializer_list
//
case 382: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPParser.java
index 294716a05f..e9cf17ad71 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPParser.java
@@ -1542,6 +1542,12 @@ public String getName() {
}
//
+ // Rule 383: initializer_clause ::= initializer_list
+ //
+ case 383: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 384: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq , } end_initializer_list
//
case 384: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPSizeofExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPSizeofExpressionParser.java
index 2ecad34fb1..2065a0c2ea 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPSizeofExpressionParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPSizeofExpressionParser.java
@@ -1553,6 +1553,12 @@ public CPPSizeofExpressionParser(ITokenStream stream, Map<String,String> propert
}
//
+ // Rule 381: initializer_clause ::= initializer_list
+ //
+ case 381: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 382: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq , } end_initializer_list
//
case 382: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPTemplateTypeParameterParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPTemplateTypeParameterParser.java
index b25f22e30a..cab084cfde 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPTemplateTypeParameterParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPTemplateTypeParameterParser.java
@@ -1567,6 +1567,12 @@ public CPPTemplateTypeParameterParser(ITokenStream stream, Map<String,String> pr
}
//
+ // Rule 383: initializer_clause ::= initializer_list
+ //
+ case 383: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 384: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq , } end_initializer_list
//
case 384: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gcc/GCCParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gcc/GCCParser.java
index 8d1c3a1b06..bec33272dc 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gcc/GCCParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gcc/GCCParser.java
@@ -1156,6 +1156,12 @@ private GNUBuildASTParserAction gnuAction;
}
//
+ // Rule 283: initializer ::= initializer_list
+ //
+ case 283: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 284: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq comma_opt } end_initializer_list
//
case 284: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gcc/GCCSizeofExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gcc/GCCSizeofExpressionParser.java
index b5dd789571..c48b02c086 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gcc/GCCSizeofExpressionParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gcc/GCCSizeofExpressionParser.java
@@ -1173,6 +1173,12 @@ private GNUBuildASTParserAction gnuAction;
}
//
+ // Rule 282: initializer ::= initializer_list
+ //
+ case 282: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 283: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq comma_opt } end_initializer_list
//
case 283: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gpp/GPPParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gpp/GPPParser.java
index 2eb08594c1..3e5b024fc4 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gpp/GPPParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gpp/GPPParser.java
@@ -1548,6 +1548,12 @@ private GNUBuildASTParserAction gnuAction;
}
//
+ // Rule 382: initializer_clause ::= initializer_list
+ //
+ case 382: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 383: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq , } end_initializer_list
//
case 383: { action. consumeInitializerList(); break;
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gpp/GPPSizeofExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gpp/GPPSizeofExpressionParser.java
index 225b31b8b9..191564d231 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gpp/GPPSizeofExpressionParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/gpp/GPPSizeofExpressionParser.java
@@ -1559,6 +1559,12 @@ private GNUBuildASTParserAction gnuAction;
}
//
+ // Rule 380: initializer_clause ::= initializer_list
+ //
+ case 380: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 381: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq , } end_initializer_list
//
case 381: { action. consumeInitializerList(); break;
diff --git a/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/XlcExtensionsTest.java b/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/XlcExtensionsTest.java
index 940abd59aa..7baa2c44c6 100644
--- a/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/XlcExtensionsTest.java
+++ b/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/XlcExtensionsTest.java
@@ -275,28 +275,6 @@ public class XlcExtensionsTest extends XlcTestBase {
parse(code, getCPPLanguage(), true); // xlc supports this in C++
}
- public void testStaticAssertions() {
- String code =
- " const unsigned int EIGHT= 8; \n"+
- " __static_assert(sizeof(long) >= EIGHT, \"no 64-bit support\"); \n" +
-
- " namespace ns { \n"+
- " __static_assert(sizeof(long) >= 4, \"no 32-bit support\"); \n" +
- " } \n" +
-
- " template <typename T> class basic_string { \n" +
- " __static_assert(T::value, \"bla\"); \n" +
- " }; \n" +
-
- " void do_something() { \n" +
- " struct VMPage { \n" +
- " }; \n" +
- " __static_assert(sizeof(VMPage) == 1, \"bla\"); \n" +
- " }";
-
- parse(code, getCPPLanguage(), true); // xlc supports this in C++
- }
-
public void testV11Attributes() {
String code =
"#define __inline__ __inline__ __attribute__((gnu_inline)) \n" +
diff --git a/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/base/XlcLRCPPTests.java b/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/base/XlcLRCPPTests.java
index 46a39b5d9c..b93b2839b2 100644
--- a/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/base/XlcLRCPPTests.java
+++ b/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/base/XlcLRCPPTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2010 IBM Corporation 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,11 +16,18 @@ import org.eclipse.cdt.core.lrparser.tests.LRCPPTests;
import org.eclipse.cdt.core.lrparser.xlc.XlcCLanguage;
import org.eclipse.cdt.core.lrparser.xlc.XlcCPPLanguage;
import org.eclipse.cdt.core.model.ILanguage;
+import org.eclipse.cdt.core.parser.ParserLanguage;
public class XlcLRCPPTests extends LRCPPTests {
public static TestSuite suite() {
return suite(XlcLRCPPTests.class);
}
+ //CDT_70_FIX_FROM_50-#9
+ public void testStaticAssertions_294730() throws Exception {
+ String code= getAboveComment();
+ code = code.replaceAll("static_assert", "__static_assert");
+ parseAndCheckBindings(code, ParserLanguage.CPP);
+ }
protected ILanguage getCLanguage() {
return XlcCLanguage.getDefault();
diff --git a/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/c/XlcCParser.java b/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/c/XlcCParser.java
index d0b1716a13..e8a887231d 100644
--- a/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/c/XlcCParser.java
+++ b/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/c/XlcCParser.java
@@ -1160,6 +1160,12 @@ private GNUBuildASTParserAction gnuAction;
}
//
+ // Rule 283: initializer ::= initializer_list
+ //
+ case 283: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 284: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq comma_opt } end_initializer_list
//
case 284: { action. consumeInitializerList(); break;
diff --git a/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/cpp/XlcCPPParser.java b/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/cpp/XlcCPPParser.java
index 60667942ca..efe4fb3ec5 100644
--- a/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/cpp/XlcCPPParser.java
+++ b/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/cpp/XlcCPPParser.java
@@ -1552,6 +1552,12 @@ private GNUBuildASTParserAction gnuAction;
}
//
+ // Rule 382: initializer_clause ::= initializer_list
+ //
+ case 382: { action. consumeInitializer(); break;
+ }
+
+ //
// Rule 383: initializer_list ::= start_initializer_list { <openscope-ast> initializer_seq , } end_initializer_list
//
case 383: { action. consumeInitializerList(); break;

Back to the top