From 7a5d9818fc4ebb77b60e543bfbe9178c7b5be23a Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Wed, 23 Jan 2013 09:09:03 -0800 Subject: [PATCH] Cosmetics. --- .../cdt/core/parser/tests/ast2/AST2Tests.java | 419 +++++++++--------- .../tests/IndexCBindingResolutionBugs.java | 56 +-- 2 files changed, 238 insertions(+), 237 deletions(-) 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 0a8e2de6c42..be0185273d1 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 @@ -13,6 +13,7 @@ *******************************************************************************/ package org.eclipse.cdt.core.parser.tests.ast2; +import static org.eclipse.cdt.core.parser.ParserLanguage.C; import static org.eclipse.cdt.core.parser.ParserLanguage.CPP; import java.io.IOException; @@ -144,21 +145,21 @@ public class AST2Tests extends AST2BaseTest { private void parseAndCheckBindings() throws Exception { String code= getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C); - parseAndCheckBindings(code, ParserLanguage.CPP); + parseAndCheckBindings(code, C); + parseAndCheckBindings(code, CPP); } protected IASTTranslationUnit parseAndCheckBindings(String code) throws Exception { - return parseAndCheckBindings(code, ParserLanguage.C); + return parseAndCheckBindings(code, C); } public void testBug75189() throws Exception { parseAndCheckBindings("struct A{};\n typedef int (*F) (struct A*);"); //$NON-NLS-1$ - parseAndCheckBindings("struct A{};\n typedef int (*F) (A*);", ParserLanguage.CPP); //$NON-NLS-1$ + parseAndCheckBindings("struct A{};\n typedef int (*F) (A*);", CPP); //$NON-NLS-1$ } public void testBug75340() throws Exception { - IASTTranslationUnit tu = parseAndCheckBindings("void f(int i = 0, int * p = 0);", ParserLanguage.CPP); //$NON-NLS-1$ + IASTTranslationUnit tu = parseAndCheckBindings("void f(int i = 0, int * p = 0);", CPP); //$NON-NLS-1$ IASTSimpleDeclaration sd = (IASTSimpleDeclaration) tu.getDeclarations()[0]; isParameterSignatureEqual(sd.getDeclarators()[0], "(int=0, int*=0)"); //$NON-NLS-1$ } @@ -190,7 +191,7 @@ public class AST2Tests extends AST2BaseTest { // int ((*zzz3)) (char); // int (*(zzz4)) (char); public void testBug40768() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); CNameCollector col = new CNameCollector(); tu.accept(col); assertNoProblemBindings(col); @@ -201,7 +202,7 @@ public class AST2Tests extends AST2BaseTest { // int z = x + y; // } public void testBasicFunction() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IScope globalScope = tu.getScope(); @@ -344,7 +345,7 @@ public class AST2Tests extends AST2BaseTest { // myS.x = 5; // } public void testSimpleStruct() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu @@ -530,7 +531,7 @@ public class AST2Tests extends AST2BaseTest { } public void testMultipleDeclarators() throws Exception { - IASTTranslationUnit tu = parse("int r, s;", ParserLanguage.C); //$NON-NLS-1$ + IASTTranslationUnit tu = parse("int r, s;", C); //$NON-NLS-1$ assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -568,7 +569,7 @@ public class AST2Tests extends AST2BaseTest { buffer.append(" struct A * a; \n"); //$NON-NLS-1$ buffer.append("} \n"); //$NON-NLS-1$ - IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C); + IASTTranslationUnit tu = parse(buffer.toString(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { @@ -647,7 +648,7 @@ public class AST2Tests extends AST2BaseTest { buffer.append(" struct A * a; \n"); //$NON-NLS-1$ buffer.append("} \r\n"); //$NON-NLS-1$ - IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C); + IASTTranslationUnit tu = parse(buffer.toString(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { @@ -712,7 +713,7 @@ public class AST2Tests extends AST2BaseTest { buffer.append(" a->i; \n"); //$NON-NLS-1$ buffer.append("} \n"); //$NON-NLS-1$ - IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C); + IASTTranslationUnit tu = parse(buffer.toString(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { @@ -818,7 +819,7 @@ public class AST2Tests extends AST2BaseTest { // struct x i; // } public void testStructureNamespace() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { @@ -906,7 +907,7 @@ public class AST2Tests extends AST2BaseTest { // } public void testFunctionParameters() throws Exception { final String code = getAboveComment(); - IASTTranslationUnit tu = parse(code, ParserLanguage.C); + IASTTranslationUnit tu = parse(code, C); assertTrue(tu.isFrozen()); // void f( @@ -947,7 +948,7 @@ public class AST2Tests extends AST2BaseTest { assertSame(param_2, param_3); assertSame(f_1, f_2); - tu = parse(code, ParserLanguage.C); + tu = parse(code, C); assertTrue(tu.isFrozen()); // void f( f_decl = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -1011,7 +1012,7 @@ public class AST2Tests extends AST2BaseTest { // void f(int a, int b) { } public void testSimpleFunction() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTFunctionDefinition fDef = (IASTFunctionDefinition) tu.getDeclarations()[0]; @@ -1061,7 +1062,7 @@ public class AST2Tests extends AST2BaseTest { // } // void f() { } public void testSimpleFunctionCall() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { @@ -1130,7 +1131,7 @@ public class AST2Tests extends AST2BaseTest { // } // } public void testForLoop() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { // void f() { @@ -1204,7 +1205,7 @@ public class AST2Tests extends AST2BaseTest { // ((struct A *) 1)->x; // } public void testExpressionFieldReference() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration simpleDecl = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -1259,7 +1260,7 @@ public class AST2Tests extends AST2BaseTest { // end: ; // } public void testLabels() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector collector = new CNameCollector(); @@ -1294,7 +1295,7 @@ public class AST2Tests extends AST2BaseTest { // typedef struct { } X; // int f(X x); public void testAnonStruct() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { // test tu.getDeclarationsInAST(IBinding) @@ -1329,7 +1330,7 @@ public class AST2Tests extends AST2BaseTest { } public void testLongLong() throws ParserException { - IASTTranslationUnit tu = parse("long long x;\n", ParserLanguage.C); //$NON-NLS-1$ + IASTTranslationUnit tu = parse("long long x;\n", C); //$NON-NLS-1$ // test tu.getDeclarationsInAST(IBinding) IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu @@ -1350,7 +1351,7 @@ public class AST2Tests extends AST2BaseTest { // return; // } public void testEnumerations() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -1489,7 +1490,7 @@ public class AST2Tests extends AST2BaseTest { } public void testPointerToFunction() throws Exception { - IASTTranslationUnit tu = parse("int (*pfi)();", ParserLanguage.C); //$NON-NLS-1$ + IASTTranslationUnit tu = parse("int (*pfi)();", C); //$NON-NLS-1$ assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { assertEquals(tu.getDeclarations().length, 1); @@ -1520,7 +1521,7 @@ public class AST2Tests extends AST2BaseTest { // const char ** e; // const char * const * const volatile ** const * f; public void testBasicTypes() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu @@ -1623,7 +1624,7 @@ public class AST2Tests extends AST2BaseTest { // unsigned int unsignedInt = 99; // noSpec= 12; public void testBug270275_int_is_equivalent_to_signed_int() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); IASTDeclaration[] declarations = tu.getDeclarations(); IType plainInt = ((IVariable)((IASTSimpleDeclaration) declarations[0]).getDeclarators()[0].getName().resolveBinding()).getType(); IType signedInt = ((IVariable)((IASTSimpleDeclaration) declarations[1]).getDeclarators()[0].getName().resolveBinding()).getType(); @@ -1640,7 +1641,7 @@ public class AST2Tests extends AST2BaseTest { // struct A * const a2; // AP a3; public void testCompositeTypes() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -1717,7 +1718,7 @@ public class AST2Tests extends AST2BaseTest { // const char * const c[][][]; // char* d[const][]; public void testArrayTypes() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -1798,7 +1799,7 @@ public class AST2Tests extends AST2BaseTest { // void (*g) (struct A *); // void (* (*h)(struct A**)) (int d); public void testFunctionTypes() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -1935,7 +1936,7 @@ public class AST2Tests extends AST2BaseTest { // Point point = {.width = 100, .pos = &xy}; // } public void testDesignatedInitializers() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { assertNotNull(tu); @@ -2041,7 +2042,7 @@ public class AST2Tests extends AST2BaseTest { // struct S s = {.a=1,.b=2}; // } public void testMoregetDeclarationsInAST1() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration S_decl = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -2081,7 +2082,7 @@ public class AST2Tests extends AST2BaseTest { // int b; // } s = {.a=1,.b=2}; public void testMoregetDeclarationsInAST2() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration S_decl = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -2122,7 +2123,7 @@ public class AST2Tests extends AST2BaseTest { // typedef t y; // y x = {.a=1,.b=2}; public void testMoregetDeclarationsInAST3() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration S_decl = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -2158,7 +2159,7 @@ public class AST2Tests extends AST2BaseTest { public void testFnReturningPtrToFn() throws Exception { IASTTranslationUnit tu = parse( - "void (* f(int))() {}", ParserLanguage.C); //$NON-NLS-1$ + "void (* f(int))() {}", C); //$NON-NLS-1$ assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTFunctionDefinition def = (IASTFunctionDefinition) tu.getDeclarations()[0]; @@ -2186,7 +2187,7 @@ public class AST2Tests extends AST2BaseTest { // array type derivation. public void testArrayTypeToQualifiedPointerTypeParm() throws Exception { IASTTranslationUnit tu = parse( - "void f(int parm[const 3]);", ParserLanguage.C); //$NON-NLS-1$ + "void f(int parm[const 3]);", C); //$NON-NLS-1$ assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration def = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -2225,7 +2226,7 @@ public class AST2Tests extends AST2BaseTest { // int *f2() {} // int (* f3())() {} public void testFunctionDefTypes() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { @@ -2268,7 +2269,7 @@ public class AST2Tests extends AST2BaseTest { // any parameter to type function returning T is adjusted to be pointer to // function returning T public void testParmToFunction() throws Exception { - IASTTranslationUnit tu = parse("int f(int g(void)) { return g();}", ParserLanguage.C); + IASTTranslationUnit tu = parse("int f(int g(void)) { return g();}", C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTFunctionDefinition def = (IASTFunctionDefinition) tu.getDeclarations()[0]; @@ -2304,7 +2305,7 @@ public class AST2Tests extends AST2BaseTest { } public void testArrayPointerFunction() throws Exception { - IASTTranslationUnit tu = parse("int (*v[])(int *x, int *y);", ParserLanguage.C); + IASTTranslationUnit tu = parse("int (*v[])(int *x, int *y);", C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { @@ -2349,7 +2350,7 @@ public class AST2Tests extends AST2BaseTest { // typedef DWORD v; // v signal(int); public void testTypedefExample4a() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { @@ -2404,7 +2405,7 @@ public class AST2Tests extends AST2BaseTest { // typedef DWORD (*pfv)(int); // pfv signal(int, pfv); public void testTypedefExample4b() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu.getDeclarations()[0]; @@ -2486,7 +2487,7 @@ public class AST2Tests extends AST2BaseTest { // fv *signal2(int, fv *); // pfv signal3(int, pfv); public void testTypedefExample4c() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { @@ -2575,7 +2576,7 @@ public class AST2Tests extends AST2BaseTest { // int y [ const static x ]; public void testBug80992() throws Exception { ICASTArrayModifier mod = (ICASTArrayModifier) ((IASTArrayDeclarator) ((IASTSimpleDeclaration) parse( - getAboveComment(), ParserLanguage.C).getDeclarations()[1]) + getAboveComment(), C).getDeclarations()[1]) .getDeclarators()[0]).getArrayModifiers()[0]; assertTrue(mod.isConst()); assertTrue(mod.isStatic()); @@ -2588,7 +2589,7 @@ public class AST2Tests extends AST2BaseTest { // int y (int [ const *]); public void testBug80978() throws Exception { ICASTArrayModifier mod = (ICASTArrayModifier) ((IASTArrayDeclarator) ((IASTStandardFunctionDeclarator) ((IASTSimpleDeclaration) parse( - getAboveComment(), ParserLanguage.C).getDeclarations()[0]) + getAboveComment(), C).getDeclarations()[0]) .getDeclarators()[0]).getParameters()[0].getDeclarator()) .getArrayModifiers()[0]; assertTrue(mod.isConst()); @@ -2598,13 +2599,13 @@ public class AST2Tests extends AST2BaseTest { assertFalse(mod.isVolatile()); } - //AJN: bug 77383 don't do external variables + //AJN: bug 77383 don't do external variables // // void f() { // // if (a == 0) // // a = a + 3; // // } // public void testExternalVariable() throws Exception { - // IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + // IASTTranslationUnit tu = parse(getAboveComment(), C); // CNameCollector col = new CNameCollector(); // tu.accept(col); // @@ -2624,7 +2625,7 @@ public class AST2Tests extends AST2BaseTest { // g(*(&a + 2)); // } public void testExternalDefs() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector col = new CNameCollector(); @@ -2649,7 +2650,7 @@ public class AST2Tests extends AST2BaseTest { // Coord xy = { .x = 10, .y = 11 }; // } public void testFieldDesignators() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector col = new CNameCollector(); @@ -2674,7 +2675,7 @@ public class AST2Tests extends AST2BaseTest { // [member_two] = "two" // }; public void testArrayDesignator() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector col = new CNameCollector(); @@ -2700,7 +2701,7 @@ public class AST2Tests extends AST2BaseTest { // g(*(&a + 2)); // } public void testBug83737() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { IASTIfStatement if_statement = (IASTIfStatement) ((IASTCompoundStatement) ((IASTFunctionDefinition) tu @@ -2730,7 +2731,7 @@ public class AST2Tests extends AST2BaseTest { // end: ; // } public void testBug84090_LabelReferences() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector col = new CNameCollector(); @@ -2750,7 +2751,7 @@ public class AST2Tests extends AST2BaseTest { // enum col { red, blue }; // enum col c; public void testBug84092_EnumReferences() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector collector = new CNameCollector(); @@ -2769,7 +2770,7 @@ public class AST2Tests extends AST2BaseTest { public void testBug84096_FieldDesignatorRef() throws Exception { IASTTranslationUnit tu = parse( - "struct s { int a; } ss = { .a = 1 }; \n", ParserLanguage.C); //$NON-NLS-1$ + "struct s { int a; } ss = { .a = 1 }; \n", C); //$NON-NLS-1$ assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector collector = new CNameCollector(); @@ -2789,7 +2790,7 @@ public class AST2Tests extends AST2BaseTest { public void testProblems() throws Exception { IASTTranslationUnit tu = parse( - " a += ;", ParserLanguage.C, true, false); //$NON-NLS-1$ + " a += ;", C, true, false); //$NON-NLS-1$ IASTProblem[] ps = CVisitor.getProblems(tu); assertEquals(ps.length, 1); ps[0].getMessage(); @@ -2798,7 +2799,7 @@ public class AST2Tests extends AST2BaseTest { // enum e; // enum e{ one }; public void testEnumerationForwards() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector col = new CNameCollector(); @@ -2821,7 +2822,7 @@ public class AST2Tests extends AST2BaseTest { // (&p)[0] = 1; // } public void testBug84185() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); CNameCollector col = new CNameCollector(); tu.accept(col); @@ -2840,7 +2841,7 @@ public class AST2Tests extends AST2BaseTest { // (&p)[0] = 1; // } public void testBug84185_2() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); CNameCollector col = new CNameCollector(); tu.accept(col); @@ -2862,14 +2863,14 @@ public class AST2Tests extends AST2BaseTest { // p = &((struct s) { j++ }); // } public void testBug84176() throws Exception { - parse(getAboveComment(), ParserLanguage.C, false, true); + parse(getAboveComment(), C, false, true); } // struct s { double i; } f(void); // struct s f(void) {} public void testBug84266() throws Exception { final String code = getAboveComment(); - IASTTranslationUnit tu = parse(code, ParserLanguage.C); + IASTTranslationUnit tu = parse(code, C); CNameCollector col = new CNameCollector(); tu.accept(col); assertEquals(col.size(), 7); @@ -2878,7 +2879,7 @@ public class AST2Tests extends AST2BaseTest { ICompositeType s_decl = (ICompositeType) col.getName(0).resolveBinding(); assertSame(s_ref, s_decl); - tu = parse(code, ParserLanguage.C); + tu = parse(code, C); col = new CNameCollector(); tu.accept(col); assertEquals(col.size(), 7); @@ -2889,7 +2890,7 @@ public class AST2Tests extends AST2BaseTest { } public void testBug84266_2() throws Exception { - IASTTranslationUnit tu = parse("struct s f(void);", ParserLanguage.C); //$NON-NLS-1$ + IASTTranslationUnit tu = parse("struct s f(void);", C); //$NON-NLS-1$ CNameCollector col = new CNameCollector(); tu.accept(col); @@ -2898,7 +2899,7 @@ public class AST2Tests extends AST2BaseTest { ICompositeType s = (ICompositeType) col.getName(0).resolveBinding(); assertNotNull(s); - tu = parse("struct s f(void) {}", ParserLanguage.C); //$NON-NLS-1$ + tu = parse("struct s f(void) {}", C); //$NON-NLS-1$ col = new CNameCollector(); tu.accept(col); @@ -2910,7 +2911,7 @@ public class AST2Tests extends AST2BaseTest { public void testBug84250() throws Exception { assertTrue(((IASTDeclarationStatement) ((IASTCompoundStatement) ((IASTFunctionDefinition) parse( - "void f() { int (*p) [2]; }", ParserLanguage.C).getDeclarations()[0]).getBody()).getStatements()[0]).getDeclaration() instanceof IASTSimpleDeclaration); //$NON-NLS-1$ + "void f() { int (*p) [2]; }", C).getDeclarations()[0]).getBody()).getStatements()[0]).getDeclaration() instanceof IASTSimpleDeclaration); //$NON-NLS-1$ } // struct s1 { struct s2 *s2p; /* ... */ }; // D1 @@ -2945,7 +2946,7 @@ public class AST2Tests extends AST2BaseTest { // funcp()->a; // } public void testBug84267() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); CNameCollector col = new CNameCollector(); tu.accept(col); @@ -2972,7 +2973,7 @@ public class AST2Tests extends AST2BaseTest { // { int x = x; } // } public void testBug84228() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); CNameCollector col = new CNameCollector(); tu.accept(col); @@ -2998,7 +2999,7 @@ public class AST2Tests extends AST2BaseTest { public void testBug84236() throws Exception { String code = "double maximum(double a[ ][*]);"; //$NON-NLS-1$ IASTSimpleDeclaration d = (IASTSimpleDeclaration) parse(code, - ParserLanguage.C).getDeclarations()[0]; + C).getDeclarations()[0]; IASTStandardFunctionDeclarator fd = (IASTStandardFunctionDeclarator) d .getDeclarators()[0]; IASTParameterDeclaration p = fd.getParameters()[0]; @@ -3013,7 +3014,7 @@ public class AST2Tests extends AST2BaseTest { // B * bp; //1 // } public void testBug85049() throws Exception { - IASTTranslationUnit t = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit t = parse(getAboveComment(), C); IASTFunctionDefinition g = (IASTFunctionDefinition) t.getDeclarations()[1]; IASTCompoundStatement body = (IASTCompoundStatement) g.getBody(); final IASTStatement statement = body.getStatements()[0]; @@ -3026,7 +3027,7 @@ public class AST2Tests extends AST2BaseTest { public void testBug86766() throws Exception { IASTTranslationUnit tu = parse( - "char foo; void foo() {}", ParserLanguage.C); //$NON-NLS-1$ + "char foo; void foo() {}", C); //$NON-NLS-1$ CNameCollector col = new CNameCollector(); tu.accept(col); @@ -3039,7 +3040,7 @@ public class AST2Tests extends AST2BaseTest { public void testBug88338_C() throws Exception { IASTTranslationUnit tu = parse( - "struct A; struct A* a;", ParserLanguage.C); //$NON-NLS-1$ + "struct A; struct A* a;", C); //$NON-NLS-1$ CPPNameCollector col = new CPPNameCollector(); tu.accept(col); @@ -3048,7 +3049,7 @@ public class AST2Tests extends AST2BaseTest { assertTrue(col.getName(1).isReference()); assertFalse(col.getName(1).isDeclaration()); - tu = parse("struct A* a; struct A;", ParserLanguage.C); //$NON-NLS-1$ + tu = parse("struct A* a; struct A;", C); //$NON-NLS-1$ col = new CPPNameCollector(); tu.accept(col); @@ -3062,7 +3063,7 @@ public class AST2Tests extends AST2BaseTest { } public void test88460() throws Exception { - IASTTranslationUnit tu = parse("void f();", ParserLanguage.C); //$NON-NLS-1$ + IASTTranslationUnit tu = parse("void f();", C); //$NON-NLS-1$ CNameCollector col = new CNameCollector(); tu.accept(col); @@ -3072,7 +3073,7 @@ public class AST2Tests extends AST2BaseTest { public void testBug90253() throws Exception { IASTTranslationUnit tu = parse( - "void f(int par) { int v1; };", ParserLanguage.C); //$NON-NLS-1$ + "void f(int par) { int v1; };", C); //$NON-NLS-1$ CNameCollector col = new CNameCollector(); tu.accept(col); @@ -3101,7 +3102,7 @@ public class AST2Tests extends AST2BaseTest { // } // } public void testFind() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); CNameCollector col = new CNameCollector(); tu.accept(col); @@ -3125,14 +3126,14 @@ public class AST2Tests extends AST2BaseTest { public void test92791() throws Exception { IASTTranslationUnit tu = parse( - "void f() { int x, y; x * y; }", ParserLanguage.C); //$NON-NLS-1$ + "void f() { int x, y; x * y; }", C); //$NON-NLS-1$ CNameCollector col = new CNameCollector(); tu.accept(col); for (int i = 0; i < col.size(); ++i) assertFalse(col.getName(i).resolveBinding() instanceof IProblemBinding); tu = parse( - "int y; void f() { typedef int x; x * y; }", ParserLanguage.C); //$NON-NLS-1$ + "int y; void f() { typedef int x; x * y; }", C); //$NON-NLS-1$ col = new CNameCollector(); tu.accept(col); for (int i = 0; i < col.size(); ++i) @@ -3141,7 +3142,7 @@ public class AST2Tests extends AST2BaseTest { public void testBug85786() throws Exception { IASTTranslationUnit tu = parse( - "void f(int); void foo () { void * p = &f; ((void (*) (int)) p) (1); }", ParserLanguage.C); //$NON-NLS-1$ + "void f(int); void foo () { void * p = &f; ((void (*) (int)) p) (1); }", C); //$NON-NLS-1$ CNameCollector nameResolver = new CNameCollector(); tu.accept(nameResolver); assertNoProblemBindings(nameResolver); @@ -3153,7 +3154,7 @@ public class AST2Tests extends AST2BaseTest { // i= (i)&0x00ff; // } public void testBug95720() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); CNameCollector nameResolver = new CNameCollector(); tu.accept(nameResolver); assertNoProblemBindings(nameResolver); @@ -3168,7 +3169,7 @@ public class AST2Tests extends AST2BaseTest { // return 0; // } public void testBug94365() throws Exception { - parse(getAboveComment(), ParserLanguage.C); + parse(getAboveComment(), C); } // #define MACRO(a) @@ -3176,7 +3177,7 @@ public class AST2Tests extends AST2BaseTest { // MACRO('"'); // } public void testBug95119_a() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); IASTDeclaration[] declarations = tu.getDeclarations(); assertEquals(declarations.length, 1); assertNotNull(declarations[0]); @@ -3192,7 +3193,7 @@ public class AST2Tests extends AST2BaseTest { // MACRO('X'); // } public void testBug95119_b() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parse(getAboveComment(), C); IASTDeclaration[] declarations = tu.getDeclarations(); assertEquals(declarations.length, 1); assertNotNull(declarations[0]); @@ -3207,13 +3208,13 @@ public class AST2Tests extends AST2BaseTest { // typedef _TYPE TYPE; // int function(TYPE (* pfv)(int parm)); public void testBug81739() throws Exception { - parse(getAboveComment(), ParserLanguage.C); + parse(getAboveComment(), C); } // float _Complex x; // double _Complex y; public void testBug95757() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C, true, true); + IASTTranslationUnit tu = parse(getAboveComment(), C, true, true); IASTDeclaration[] decls = tu.getDeclarations(); assertTrue(((ICASTSimpleDeclSpecifier)((IASTSimpleDeclaration) decls[0]).getDeclSpecifier()).isComplex()); @@ -3226,7 +3227,7 @@ public class AST2Tests extends AST2BaseTest { // typeof({ int x = foo(); // x; }) zoot; public void testBug93980() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C, true); + IASTTranslationUnit tu = parse(getAboveComment(), C, true); CNameCollector col = new CNameCollector(); tu.accept(col); @@ -3240,14 +3241,14 @@ public class AST2Tests extends AST2BaseTest { } public void testBug95866() throws Exception { - IASTTranslationUnit tu = parse("int test[10] = { [0 ... 9] = 2 };", ParserLanguage.C, true, true); //$NON-NLS-1$ + IASTTranslationUnit tu = parse("int test[10] = { [0 ... 9] = 2 };", C, true, true); //$NON-NLS-1$ CNameCollector col = new CNameCollector(); tu.accept(col); assertNoProblemBindings(col); } public void testBug98502() throws Exception { - IASTTranslationUnit tu = parse("typedef enum { ONE } e;", ParserLanguage.C, true, true); //$NON-NLS-1$ + IASTTranslationUnit tu = parse("typedef enum { ONE } e;", C, true, true); //$NON-NLS-1$ CNameCollector col = new CNameCollector(); tu.accept(col); @@ -3263,7 +3264,7 @@ public class AST2Tests extends AST2BaseTest { // PIPERR; // } public void testBug98365() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C, true); + IASTTranslationUnit tu = parse(getAboveComment(), C, true); CNameCollector col = new CNameCollector(); tu.accept(col); @@ -3272,7 +3273,7 @@ public class AST2Tests extends AST2BaseTest { } public void testBug99262() throws Exception { - parse("void foo() {void *f; f=__null;}", ParserLanguage.C, true, true); //$NON-NLS-1$ + parse("void foo() {void *f; f=__null;}", C, true, true); //$NON-NLS-1$ } // void f1(int*) { @@ -3280,7 +3281,7 @@ public class AST2Tests extends AST2BaseTest { // void f2() { // f1(__null); // } - public void testBug240567() throws Exception { + public void testBug240567() throws Exception { BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), false); bh.assertNonProblem("f1(__null", 2, IFunction.class); } @@ -3290,7 +3291,7 @@ public class AST2Tests extends AST2BaseTest { // { a; int a; } // } public void testBug98960() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C, true); + IASTTranslationUnit tu = parse(getAboveComment(), C, true); CNameCollector col = new CNameCollector(); tu.accept(col); @@ -3303,7 +3304,7 @@ public class AST2Tests extends AST2BaseTest { } public void testBug100408() throws Exception { - IASTTranslationUnit tu = parse("int foo() { int x=1; (x)*3; }", ParserLanguage.C); //$NON-NLS-1$ + IASTTranslationUnit tu = parse("int foo() { int x=1; (x)*3; }", C); //$NON-NLS-1$ CNameCollector col = new CNameCollector(); tu.accept(col); assertNoProblemBindings(col); @@ -3319,7 +3320,7 @@ public class AST2Tests extends AST2BaseTest { // { // } public void testBug98760() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C, true); + IASTTranslationUnit tu = parse(getAboveComment(), C, true); CNameCollector col = new CNameCollector(); tu.accept(col); @@ -3396,7 +3397,7 @@ public class AST2Tests extends AST2BaseTest { // blah: x; // } public void testBug104390_2() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C, true); + IASTTranslationUnit tu = parse(getAboveComment(), C, true); CNameCollector col = new CNameCollector(); tu.accept(col); @@ -3429,9 +3430,9 @@ public class AST2Tests extends AST2BaseTest { buffer.append("((int arg1)) {\r\n"); //$NON-NLS-1$ buffer.append("return 0;\r\n"); //$NON-NLS-1$ buffer.append("}\r\n"); //$NON-NLS-1$ - IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C); + IASTTranslationUnit tu = parse(buffer.toString(), C); assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration); - tu = parse(buffer.toString(), ParserLanguage.CPP); + tu = parse(buffer.toString(), CPP); assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration); buffer = new StringBuffer(); @@ -3443,9 +3444,9 @@ public class AST2Tests extends AST2BaseTest { buffer.append("((int arg1)) {\n"); //$NON-NLS-1$ buffer.append("return 0;\n"); //$NON-NLS-1$ buffer.append("}\n"); //$NON-NLS-1$ - tu= parse(buffer.toString(), ParserLanguage.C); + tu= parse(buffer.toString(), C); assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration); - tu= parse(buffer.toString(), ParserLanguage.CPP); + tu= parse(buffer.toString(), CPP); assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration); } @@ -3459,10 +3460,10 @@ public class AST2Tests extends AST2BaseTest { buffer.append("((int arg1)) {\r\n"); //$NON-NLS-1$ buffer.append("return 0;\r\n"); //$NON-NLS-1$ buffer.append("}\r\n"); //$NON-NLS-1$ - IASTTranslationUnit tu= parse(buffer.toString(), ParserLanguage.C); + IASTTranslationUnit tu= parse(buffer.toString(), C); assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration); - tu = parse(buffer.toString(), ParserLanguage.CPP); + tu = parse(buffer.toString(), CPP); assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration); buffer = new StringBuffer(); @@ -3474,9 +3475,9 @@ public class AST2Tests extends AST2BaseTest { buffer.append("((int arg1)) {\n"); //$NON-NLS-1$ buffer.append("return 0;\n"); //$NON-NLS-1$ buffer.append("}\n"); //$NON-NLS-1$ - tu = parse(buffer.toString(), ParserLanguage.C); + tu = parse(buffer.toString(), C); assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration); - tu = parse(buffer.toString(), ParserLanguage.CPP); + tu = parse(buffer.toString(), CPP); assertFalse(tu.getDeclarations()[1] instanceof IASTProblemDeclaration); } @@ -3522,7 +3523,7 @@ public class AST2Tests extends AST2BaseTest { // return newWindow; // } public void testBug143502() throws Exception { - parse(getAboveComment(), ParserLanguage.C, true, false); + parse(getAboveComment(), C, true, false); } // void func(int a) { @@ -3537,13 +3538,13 @@ public class AST2Tests extends AST2BaseTest { // } public void testBracketAroundIdentifier_168924() throws IOException, ParserException { String content= getAboveComment(); - IASTTranslationUnit tu= parse(content, ParserLanguage.C, true, true); + IASTTranslationUnit tu= parse(content, C, true, true); IASTFunctionDefinition func= (IASTFunctionDefinition) tu.getDeclarations()[0]; IASTParameterDeclaration[] params= ((IASTStandardFunctionDeclarator) func.getDeclarator()).getParameters(); IBinding binding= params[0].getDeclarator().getName().resolveBinding(); assertEquals(7, tu.getReferences(binding).length); - tu= parse(content, ParserLanguage.CPP, true, true); + tu= parse(content, CPP, true, true); func= (IASTFunctionDefinition) tu.getDeclarations()[0]; params= ((IASTStandardFunctionDeclarator) func.getDeclarator()).getParameters(); binding= params[0].getDeclarator().getName().resolveBinding(); @@ -3555,7 +3556,7 @@ public class AST2Tests extends AST2BaseTest { // MAC("); // } public void testBug179383() throws ParserException, IOException { - parse(getAboveComment(), ParserLanguage.C, false, false); + parse(getAboveComment(), C, false, false); } /** @@ -3572,7 +3573,7 @@ public class AST2Tests extends AST2BaseTest { " return func(LIT); // fails to parse\r\n" + "}\r\n"; - IASTTranslationUnit tu = parse(simple, ParserLanguage.CPP, true, true); + IASTTranslationUnit tu = parse(simple, CPP, true, true); // actual reduced test case, plus extra cases String text = @@ -3594,7 +3595,7 @@ public class AST2Tests extends AST2BaseTest { ; // essential test: this code should be parseable - tu = parse(text, ParserLanguage.CPP, true, true); + tu = parse(text, CPP, true, true); // verify macros IASTPreprocessorMacroDefinition[] macroDefinitions = tu.getMacroDefinitions(); @@ -3692,11 +3693,11 @@ public class AST2Tests extends AST2BaseTest { // this should work String textNoComment = noCommentMacro + textTail; - IASTTranslationUnit tu = parse(textNoComment, ParserLanguage.CPP, true, true); + IASTTranslationUnit tu = parse(textNoComment, CPP, true, true); // this fails String textComment = commentMacro + textTail; - tu = parse(textComment, ParserLanguage.CPP, true, true); + tu = parse(textComment, CPP, true, true); } @@ -3716,7 +3717,7 @@ public class AST2Tests extends AST2BaseTest { " } \n" + "}\n"; - parseAndCheckBindings(code, ParserLanguage.C); + parseAndCheckBindings(code, C); } // template @@ -3744,7 +3745,7 @@ public class AST2Tests extends AST2BaseTest { // } // }; public void test186736() throws Exception { - IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP); + IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment(), CPP); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector col = new CNameCollector(); @@ -3796,7 +3797,7 @@ public class AST2Tests extends AST2BaseTest { // } // }; public void test186736_variant1() throws Exception { - IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP); + IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment(), CPP); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector col = new CNameCollector(); @@ -3834,7 +3835,7 @@ public class AST2Tests extends AST2BaseTest { // (&a)->foo(); // } public void test186736_variant2() throws Exception { - IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP); + IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment(), CPP); validateCopy(tu); } @@ -3843,8 +3844,8 @@ public class AST2Tests extends AST2BaseTest { // return *p; // } public void test167833() throws Exception { - parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP); - parseAndCheckBindings(getAboveComment(), ParserLanguage.C); + parseAndCheckBindings(getAboveComment(), CPP); + parseAndCheckBindings(getAboveComment(), C); } // // this is a \ @@ -3885,7 +3886,7 @@ public class AST2Tests extends AST2BaseTest { final IBinding typedef = col.getName(12).resolveBinding(); final IBinding secondJ = col.getName(13).resolveBinding(); assertInstance(typedef, ITypedef.class); - if (lang == ParserLanguage.CPP) { + if (lang == CPP) { assertInstance(secondJ, IProblemBinding.class); } else { // for plain C this is actually not a problem, the second J has to be interpreted as a (useless) @@ -3901,8 +3902,8 @@ public class AST2Tests extends AST2BaseTest { // INVALID(1, 2) // public void test192639() throws Exception { - parse(getAboveComment(), ParserLanguage.CPP, false, false); - parse(getAboveComment(), ParserLanguage.C, false, false); + parse(getAboveComment(), CPP, false, false); + parse(getAboveComment(), C, false, false); } public void test195943() throws Exception { @@ -3914,19 +3915,19 @@ public class AST2Tests extends AST2BaseTest { } buffer.append("int a= M" + (depth-1) + ";\n"); long time= System.currentTimeMillis(); - parse(buffer.toString(), ParserLanguage.CPP); - parse(buffer.toString(), ParserLanguage.C); + parse(buffer.toString(), CPP); + parse(buffer.toString(), C); assertTrue(System.currentTimeMillis()-time < 2000); } // int array[12]= {}; public void testBug196468_emptyArrayInitializer() throws Exception { final String content = getAboveComment(); - parse(content, ParserLanguage.CPP, false); - parse(content, ParserLanguage.CPP, true); - parse(content, ParserLanguage.C, true); + parse(content, CPP, false); + parse(content, CPP, true); + parse(content, C, true); try { - parse(content, ParserLanguage.C, false); + parse(content, C, false); fail("C89 does not allow empty braces in array initializer"); } catch (ParserException e) { @@ -3945,16 +3946,16 @@ public class AST2Tests extends AST2BaseTest { // } public void testBug197633_parenthesisInVarargMacros() throws Exception { final String content = getAboveComment(); - parse(content, ParserLanguage.CPP); - parse(content, ParserLanguage.C); + parse(content, CPP); + parse(content, C); } // void (__attribute__((__stdcall__))* foo1) (int); // void (* __attribute__((__stdcall__)) foo2) (int); // void (* __attribute__((__stdcall__))* foo3) (int); public void testBug191450_attributesInBetweenPointers() throws Exception { - parse(getAboveComment(), ParserLanguage.CPP, true, true); - parse(getAboveComment(), ParserLanguage.C, true, true); + parse(getAboveComment(), CPP, true, true); + parse(getAboveComment(), C, true, true); } // class NameClash {}; @@ -3962,7 +3963,7 @@ public class AST2Tests extends AST2BaseTest { // namespace NameClash2 {}; // class NameClash2 {}; public void testBug202271_nameClash() throws Exception { - IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP, true); + IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment(), CPP, true); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector col = new CNameCollector(); @@ -3982,7 +3983,7 @@ public class AST2Tests extends AST2BaseTest { // int b= WRAP(MACRO); public void testBug94673_refsForMacrosAsArguments() throws Exception { String content= getAboveComment(); - IASTTranslationUnit tu= parseAndCheckBindings(content, ParserLanguage.CPP, true); + IASTTranslationUnit tu= parseAndCheckBindings(content, CPP, true); IASTPreprocessorMacroDefinition[] defs= tu.getMacroDefinitions(); assertEquals(2, defs.length); IASTPreprocessorMacroDefinition md= defs[1]; @@ -4041,10 +4042,10 @@ public class AST2Tests extends AST2BaseTest { CharSequence[] buffer = getContents(2); final String content1 = buffer[0].toString(); final String content2 = buffer[1].toString(); - parse(content1, ParserLanguage.CPP); - parse(content1, ParserLanguage.C); - parse(content2, ParserLanguage.CPP); - parse(content2, ParserLanguage.C); + parse(content1, CPP); + parse(content1, C); + parse(content2, CPP); + parse(content2, C); } @@ -4065,14 +4066,14 @@ public class AST2Tests extends AST2BaseTest { // // int foo() { // Point p1 = {.x = 1, .y = 2}; - // + // // Line l1 = {.p1 = {.x = 1, .y = 2}, {.x = 1, .y = 2}, {.tag = 5}}; // Line l2 = {.t.tag = 9, .p1.x = 1, .p2.x = 3, .p1.y = 4, .p2.y = 9}; // // Point points[] = {{.x=1, .y=1}, {.x=2, .y=2}}; // } public void _testBug210019_nestedDesignatedInitializers() throws Exception { - IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), C); CNameCollector col = new CNameCollector(); tu.accept(col); @@ -4150,7 +4151,7 @@ public class AST2Tests extends AST2BaseTest { // 3, 4 // }; public void testBug210019_designatedInitializers() throws Exception { - IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), C); assertTrue(tu.isFrozen()); for (int i = 0; i < NUM_TESTS; i++) { CNameCollector col = new CNameCollector(); @@ -4189,7 +4190,7 @@ public class AST2Tests extends AST2BaseTest { // externFunc(); // } public void testBug183126_nestedLinkageSpecs() throws Exception { - parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP); + parseAndCheckBindings(getAboveComment(), CPP); } // int* i= 0; @@ -4203,7 +4204,7 @@ public class AST2Tests extends AST2BaseTest { // f3(&i); // ok // } public void testBug213029_cvConversion() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.CPP, false); + IASTTranslationUnit tu = parse(getAboveComment(), CPP, false); CNameCollector col = new CNameCollector(); tu.accept(col); for (Object o : col.nameList) { @@ -4694,8 +4695,8 @@ public class AST2Tests extends AST2BaseTest { // } public void testOmittedPositiveExpression_212905() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C); - parseAndCheckBindings(code, ParserLanguage.CPP); + parseAndCheckBindings(code, C); + parseAndCheckBindings(code, CPP); } // #define __inline__ __inline__ __attribute__((always_inline)) @@ -4705,16 +4706,16 @@ public class AST2Tests extends AST2BaseTest { // } public void testRedefinedGCCKeywords_226112() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // int foo asm ("myfoo") __attribute__((__used__)), ff asm("ss") = 2; // extern void func () asm ("FUNC") __attribute__((__used__)); public void testASMLabels_226121() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // void test() { @@ -4722,8 +4723,8 @@ public class AST2Tests extends AST2BaseTest { // } public void testCompoundStatementExpression_226274() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // void test(int count) { @@ -4732,8 +4733,8 @@ public class AST2Tests extends AST2BaseTest { // } public void testTypeofUnaryExpression_226492() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // void test(int count) { @@ -4741,8 +4742,8 @@ public class AST2Tests extends AST2BaseTest { // } public void testTypeofExpression_226492() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // void func() { @@ -4750,8 +4751,8 @@ public class AST2Tests extends AST2BaseTest { // } public void testTypeofExpressionWithAttribute_226492() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // void test(int count) { @@ -4762,7 +4763,7 @@ public class AST2Tests extends AST2BaseTest { public void testCaseRange_211882() throws Exception { final String code = getAboveComment(); { - IASTTranslationUnit tu = parseAndCheckBindings(code, ParserLanguage.C, true); + IASTTranslationUnit tu = parseAndCheckBindings(code, C, true); IASTCompoundStatement body = (IASTCompoundStatement)((IASTFunctionDefinition) tu.getDeclarations()[0]).getBody(); IASTSwitchStatement switchStmt = (IASTSwitchStatement) body.getStatements()[0]; IASTCaseStatement caseStmt = (IASTCaseStatement)((IASTCompoundStatement) switchStmt.getBody()).getStatements()[0]; @@ -4772,7 +4773,7 @@ public class AST2Tests extends AST2BaseTest { assertTrue(binExpr.getOperand2() instanceof IASTLiteralExpression); } { - IASTTranslationUnit tu = parseAndCheckBindings(code, ParserLanguage.CPP, true); + IASTTranslationUnit tu = parseAndCheckBindings(code, CPP, true); IASTCompoundStatement body = (IASTCompoundStatement)((IASTFunctionDefinition) tu.getDeclarations()[0]).getBody(); IASTSwitchStatement switchStmt = (IASTSwitchStatement) body.getStatements()[0]; IASTCaseStatement caseStmt = (IASTCaseStatement)((IASTCompoundStatement) switchStmt.getBody()).getStatements()[0]; @@ -4788,8 +4789,8 @@ public class AST2Tests extends AST2BaseTest { // int x(int(TIntPtr)); public void testInfiniteRecursion_269052() throws Exception { final String code= getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // template class X { @@ -4799,29 +4800,29 @@ public class AST2Tests extends AST2BaseTest { // }; public void testTypenameInExpression() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.CPP); + parseAndCheckBindings(code, CPP); } // struct __attribute__((declspec)) bla; public void testAttributeInElaboratedTypeSpecifier_227085() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // struct X; // void test(struct X* __restrict result); public void testRestrictReference_227110() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, CPP, true); } // char buf[256]; // int x= sizeof(buf)[0]; public void testSizeofUnaryWithParenthesis_227122() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C); - parseAndCheckBindings(code, ParserLanguage.CPP); + parseAndCheckBindings(code, C); + parseAndCheckBindings(code, CPP); } // class X { @@ -4835,7 +4836,7 @@ public class AST2Tests extends AST2BaseTest { // } public void testPlacementNewInConditionalExpression_227104() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.CPP); + parseAndCheckBindings(code, CPP); } // int f(x) { @@ -4843,7 +4844,7 @@ public class AST2Tests extends AST2BaseTest { // } public void testBug228422_noKnrParam() throws Exception { CharSequence buffer = getContents(1)[0]; - parse(buffer.toString(), ParserLanguage.C, false); + parse(buffer.toString(), C, false); } // struct { @@ -4896,8 +4897,8 @@ public class AST2Tests extends AST2BaseTest { // } public void testTypeOfPointerOperations() throws Exception { String code= getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C); - parseAndCheckBindings(code, ParserLanguage.CPP); + parseAndCheckBindings(code, C); + parseAndCheckBindings(code, CPP); } // int globalArray[4] = {1,2,3,4}; @@ -4960,8 +4961,8 @@ public class AST2Tests extends AST2BaseTest { // } public void testReturnTypeOfBuiltin_234309() throws Exception { String code= getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // typedef void VOID; @@ -5490,7 +5491,7 @@ public class AST2Tests extends AST2BaseTest { // spinlock_t _lock = (spinlock_t) { }; public void testCompoundInitializer_145387() throws Exception { // valid in C99, not in C++. - parseAndCheckBindings(getAboveComment(), ParserLanguage.C, true); + parseAndCheckBindings(getAboveComment(), C, true); } // enum __declspec(uuid("uuid")) bla { a, b}; @@ -5534,8 +5535,8 @@ public class AST2Tests extends AST2BaseTest { // alloc(__func__); // } public void testPredefinedFunctionName_247747() throws Exception { - parseAndCheckBindings(getAboveComment(), ParserLanguage.C, false); - parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP, false); + parseAndCheckBindings(getAboveComment(), C, false); + parseAndCheckBindings(getAboveComment(), CPP, false); } // void alloc(const char * id) {} @@ -5545,16 +5546,16 @@ public class AST2Tests extends AST2BaseTest { // alloc(__PRETTY_FUNCTION__); // } public void testPredefinedFunctionNameGcc_247747() throws Exception { - parseAndCheckBindings(getAboveComment(), ParserLanguage.C, true); - parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP, true); + parseAndCheckBindings(getAboveComment(), C, true); + parseAndCheckBindings(getAboveComment(), CPP, true); } // int foo = 42; // typedef char StupidType; // StupidType const *bar = (StupidType const*)&foo; public void testUnusualDeclSpecOrdering_251514() throws Exception { - parseAndCheckBindings(getAboveComment(), ParserLanguage.C, true); - parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP, true); + parseAndCheckBindings(getAboveComment(), C, true); + parseAndCheckBindings(getAboveComment(), CPP, true); } // #define IF if @@ -5872,7 +5873,7 @@ public class AST2Tests extends AST2BaseTest { // {1,2,3}, // 1.2, // { - + // 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // } @@ -5978,8 +5979,8 @@ public class AST2Tests extends AST2BaseTest { // } public void testNestedDeclarator_257540() throws Exception { final String code= getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C); - parseAndCheckBindings(code, ParserLanguage.CPP); + parseAndCheckBindings(code, C); + parseAndCheckBindings(code, CPP); } // typedef struct { @@ -5992,8 +5993,8 @@ public class AST2Tests extends AST2BaseTest { // } public void testCompoundLiterals_258496() throws Exception { final String code= getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C); - parseAndCheckBindings(code, ParserLanguage.CPP); + parseAndCheckBindings(code, C); + parseAndCheckBindings(code, CPP); } // __thread int i; @@ -6001,8 +6002,8 @@ public class AST2Tests extends AST2BaseTest { // extern __thread int k; public void testThreadLocalVariables_260387() throws Exception { final String code= getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // void test() { @@ -6027,7 +6028,7 @@ public class AST2Tests extends AST2BaseTest { // }; public void testAmbiguousDeclaration_259373() throws Exception { final String code= getAboveComment(); - IASTTranslationUnit tu= parseAndCheckBindings(code, ParserLanguage.C, true); + IASTTranslationUnit tu= parseAndCheckBindings(code, C, true); BindingAssertionHelper bh= new BindingAssertionHelper(code, false); ITypedef td= bh.assertNonProblem("TInt; //", 4); IField f= bh.assertNonProblem("a;", 1); @@ -6062,7 +6063,7 @@ public class AST2Tests extends AST2BaseTest { for (ParserLanguage lang : ParserLanguage.values()) { IASTTranslationUnit tu= parseAndCheckBindings(code, lang, true); - BindingAssertionHelper ba= new BindingAssertionHelper(code, lang == ParserLanguage.CPP); + BindingAssertionHelper ba= new BindingAssertionHelper(code, lang == CPP); ITypedef t= ba.assertNonProblem("A;", 1); ICompositeType s1= ba.assertNonProblem("A; // struct", 1); ICompositeType s2= ba.assertNonProblem("A*", 1); @@ -6072,7 +6073,7 @@ public class AST2Tests extends AST2BaseTest { } // typedef long unsigned int size_t; - // + // // size_t a = 0; // size_t x = a + 5; // size_t y = 2 + a; @@ -6095,7 +6096,7 @@ public class AST2Tests extends AST2BaseTest { // typedef void* VoidPtr; // typedef VoidPtr (*Func)(); - // + // // void test(Func f) { // f(); // } @@ -6127,7 +6128,7 @@ public class AST2Tests extends AST2BaseTest { public void testSizeofFunctionType_252243() throws Exception { final String code= getAboveComment(); for (ParserLanguage lang : ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(code, lang == ParserLanguage.CPP); + BindingAssertionHelper ba= new BindingAssertionHelper(code, lang == CPP); ba.assertProblem("y));", 1); IVariable v= ba.assertNonProblem("y);", 1); } @@ -6341,7 +6342,7 @@ public class AST2Tests extends AST2BaseTest { // __TIME__; // } public void testPredefinedMacroNamesC() throws Exception { - parseAndCheckBindings(getAboveComment(), ParserLanguage.C); + parseAndCheckBindings(getAboveComment(), C); } // long double longDouble = 1.0; @@ -6872,7 +6873,7 @@ public class AST2Tests extends AST2BaseTest { // int MyGlobal[10]; // public void testBug273797() throws Exception { - IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), C); IASTName n = ((IASTSimpleDeclaration) tu.getDeclarations()[0]).getDeclarators()[0].getName(); IVariable v = (IVariable) n.resolveBinding(); @@ -6894,7 +6895,7 @@ public class AST2Tests extends AST2BaseTest { // (int) value1; // } public void testBug278797() throws Exception { - IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), ParserLanguage.C); + IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), C); IASTFunctionDefinition func = (IASTFunctionDefinition) tu.getDeclarations()[1]; IASTExpressionStatement stmt = ((IASTExpressionStatement)((IASTCompoundStatement) func.getBody()).getStatements()[0]); IType t = ((IASTCastExpression) stmt.getExpression()).getOperand().getExpressionType(); @@ -6994,7 +6995,7 @@ public class AST2Tests extends AST2BaseTest { // structure.ptr = goo; // } public void testBindingsOnFields() throws Exception { - IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C, false); + IASTTranslationUnit tu = parse(getAboveComment(), C, false); IASTCompoundStatement bodyStmt = (IASTCompoundStatement)((IASTFunctionDefinition) tu.getDeclarations()[2]).getBody(); // Get the IFields bindings from the type used in the declaration of structure @@ -7006,7 +7007,7 @@ public class AST2Tests extends AST2BaseTest { // Get the IField for the first assignment IASTFieldReference ref1 = (IASTFieldReference)((IASTBinaryExpression)((IASTExpressionStatement) bodyStmt.getStatements()[1]).getExpression()).getOperand1(); IBinding field1 = ref1.getFieldName().resolveBinding(); - + // Get the IField for the second assignment IASTFieldReference ref2 = (IASTFieldReference)((IASTBinaryExpression)((IASTExpressionStatement) bodyStmt.getStatements()[2]).getExpression()).getOperand1(); IBinding field2 = ref2.getFieldName().resolveBinding(); @@ -7014,7 +7015,7 @@ public class AST2Tests extends AST2BaseTest { // Compare the IField from the type and the assignments assertEquals(fields[0], field1); assertEquals(fields[1], field2); // fails - + assertEquals(1, ((ICInternalBinding) field1).getDeclarations().length); assertEquals(1, ((ICInternalBinding) field2).getDeclarations().length); } @@ -7092,8 +7093,8 @@ public class AST2Tests extends AST2BaseTest { // int a[1]; public void testIncompleteArrays_269926() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C); - parseAndCheckBindings(code, ParserLanguage.CPP); + parseAndCheckBindings(code, C); + parseAndCheckBindings(code, CPP); } // void f1(const int* p); @@ -7146,7 +7147,7 @@ public class AST2Tests extends AST2BaseTest { // static a[2]= {0,0}; public void testSkipAggregateInitializer_297550() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, false, true); + parseAndCheckBindings(code, C, false, true); } // typeof(b(1)) b(int); @@ -7187,8 +7188,8 @@ public class AST2Tests extends AST2BaseTest { // void f () __attribute__ ((int)); public void testAttributeSyntax_298841() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // void func(int* obj) { @@ -7211,7 +7212,7 @@ public class AST2Tests extends AST2BaseTest { // ONCE() public void testPragmaOperator_294730() throws Exception { final String code = getAboveComment(); - IASTTranslationUnit tu= parseAndCheckBindings(code, ParserLanguage.C); + IASTTranslationUnit tu= parseAndCheckBindings(code, C); IASTPreprocessorStatement[] stmts = tu.getAllPreprocessorStatements(); assertEquals(5, stmts.length); for (int i = 2; i < stmts.length; i++) { @@ -7219,7 +7220,7 @@ public class AST2Tests extends AST2BaseTest { assertInstance(stmt, IASTPreprocessorPragmaStatement.class); assertEquals(i>2, ((IASTPreprocessorPragmaStatement) stmt).isPragmaOperator()); } - tu= parseAndCheckBindings(code, ParserLanguage.CPP); + tu= parseAndCheckBindings(code, CPP); assertEquals(5, stmts.length); for (int i = 2; i < stmts.length; i++) { IASTPreprocessorStatement stmt = stmts[i]; @@ -7234,8 +7235,8 @@ public class AST2Tests extends AST2BaseTest { // } public void testFunctionNameExpression() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // #define MACRO @@ -7264,8 +7265,8 @@ public class AST2Tests extends AST2BaseTest { // } public void testVaArgWithFunctionPtr_311030() throws Exception { final String code = getAboveComment(); - parseAndCheckBindings(code, ParserLanguage.C, true); - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, C, true); + parseAndCheckBindings(code, CPP, true); } // void test() { @@ -7308,7 +7309,7 @@ public class AST2Tests extends AST2BaseTest { public void testPtrDiffRecursion_317004() throws Exception { final String comment = getAboveComment(); String code= comment; - parseAndCheckBindings(code, ParserLanguage.C, true); + parseAndCheckBindings(code, C, true); BindingAssertionHelper bh= new BindingAssertionHelper(code, false); ITypedef td= bh.assertNonProblem("ptrdiff_t", 0); assertEquals("int", ASTTypeUtil.getType(td.getType())); @@ -7316,7 +7317,7 @@ public class AST2Tests extends AST2BaseTest { assertEquals("unsigned long int", ASTTypeUtil.getType(td.getType())); code= "namespace std {" + comment + "}"; - parseAndCheckBindings(code, ParserLanguage.CPP, true); + parseAndCheckBindings(code, CPP, true); bh= new BindingAssertionHelper(code, true); td= bh.assertNonProblem("ptrdiff_t", 0); assertEquals("int", ASTTypeUtil.getType(td.getType())); @@ -7365,14 +7366,14 @@ public class AST2Tests extends AST2BaseTest { // } public void testTypeOfSizeof_355052() throws Exception { final String code = getAboveComment(); - IASTTranslationUnit tu= parseAndCheckBindings(code, ParserLanguage.CPP); + IASTTranslationUnit tu= parseAndCheckBindings(code, CPP); IASTFunctionDefinition a= getDeclaration(tu, 0); IASTExpressionStatement es= getStatement(a, 1); assertEquals("unsigned long int", ASTTypeUtil.getType(es.getExpression().getExpressionType())); es= getStatement(a, 2); assertEquals("unsigned long int", ASTTypeUtil.getType(es.getExpression().getExpressionType())); - tu= parseAndCheckBindings(code, ParserLanguage.C); + tu= parseAndCheckBindings(code, C); a= getDeclaration(tu, 0); es= getStatement(a, 1); assertEquals("unsigned long int", ASTTypeUtil.getType(es.getExpression().getExpressionType())); @@ -7420,9 +7421,9 @@ public class AST2Tests extends AST2BaseTest { public void testGCCDecltype_397227() throws Exception { parseAndCheckBindings(getAboveComment(), CPP, true); } - + // #define macro(R) #R"" public void testNoRawStringInPlainC_397127() throws Exception { - parseAndCheckBindings(getAboveComment(), ParserLanguage.C, true); + parseAndCheckBindings(getAboveComment(), C, true); } } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java index c2210a5712e..1f4f785bdde 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java @@ -42,20 +42,20 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase public ProjectWithDepProj() { setStrategy(new ReferencedProject(false)); } public static TestSuite suite() { return suite(ProjectWithDepProj.class); } } - - public static void addTests(TestSuite suite) { + + public static void addTests(TestSuite suite) { suite.addTest(SingleProject.suite()); suite.addTest(ProjectWithDepProj.suite()); } - // #include + // #include // void func1(void) { // int i = 0; // for (i=0; i<10;i++) { // printf("%i", i); // } // } - + // #include "header.h" // // int main(void) { @@ -77,7 +77,7 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase } // void func1(void); - + // #include "header.h" // // int main(void) { @@ -87,7 +87,7 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase IBinding b0 = getBindingFromASTName("func1;", 5); assertTrue(b0 instanceof IFunction); } - + // typedef struct { // int utm; // } usertype; @@ -132,7 +132,7 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase assertInstance(type, IEnumeration.class); assertTrue(type instanceof IEnumeration); } - + // int globalVar; // // don't include header @@ -268,10 +268,10 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase e= (IEnumeration) b1; ei= e.getEnumerators(); assertEquals(1, ei.length); - } + } // // no header needed - + // typedef struct { // int member; // } t_struct; @@ -289,7 +289,7 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase assertTrue(tdIndex instanceof IIndexBinding); assertTrue(tdAST instanceof ITypedef); assertTrue(tdIndex instanceof ITypedef); - + IType tAST= ((ITypedef) tdAST).getType(); IType tIndex= ((ITypedef) tdIndex).getType(); assertTrue(tAST instanceof ICompositeType); @@ -304,7 +304,7 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase assertTrue(tdIndex instanceof IIndexBinding); assertTrue(tdAST instanceof ITypedef); assertTrue(tdIndex instanceof ITypedef); - + tAST= ((ITypedef) tdAST).getType(); tIndex= ((ITypedef) tdIndex).getType(); assertTrue(tAST instanceof ICompositeType); @@ -319,7 +319,7 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase assertTrue(tdIndex instanceof IIndexBinding); assertTrue(tdAST instanceof ITypedef); assertTrue(tdIndex instanceof ITypedef); - + tAST= ((ITypedef) tdAST).getType(); tIndex= ((ITypedef) tdIndex).getType(); assertTrue(tAST instanceof IEnumeration); @@ -327,13 +327,13 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase assertTrue(tAST.isSameType(tIndex)); assertTrue(tIndex.isSameType(tAST)); } - + // struct outer { // union { // int var1; // }; // }; - + // #include "header.h" // void test() { // struct outer x; @@ -354,7 +354,7 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase // int var1; // }; // }; - + // #include "header.h" // void test() { // union outer x; @@ -369,14 +369,14 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase assertTrue(outer instanceof ICCompositeTypeScope); assertEquals("outer", outer.getScopeName().toString()); } - + // int myFunc(); - + // int myFunc(var) - // int var; - // { - // return var; - // } + // int var; + // { + // return var; + // } // int main(void) { // return myFunc(0); // } @@ -390,7 +390,7 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase assertTrue(params[0].getType() instanceof IBasicType); assertEquals(IBasicType.Kind.eInt, ((IBasicType) params[0].getType()).getKind()); } - + // typedef struct S S; // void setValue(S *pSelf, int value); @@ -404,7 +404,7 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase IBinding b = getBindingFromASTName("value =", 5); assertTrue(b instanceof IField); } - + // void f255( // int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, // int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, @@ -439,8 +439,8 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase // int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, // int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, // int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int); - - // void test() { + + // void test() { // f255( // 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -463,8 +463,8 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase public void testFunctionsWithManyParameters_Bug319186() throws Exception { getBindingFromASTName("f255", 0); getBindingFromASTName("f256", 0); - } - + } + // struct B { // float f; // }; @@ -474,5 +474,5 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase // }; public void testDesignatedInitializer_Bug210019() throws Exception { IField f= getBindingFromASTName("f", 0); - } + } }