mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for John Camelon:
CORE Revisited bug36247 Parser confused by symbols #defined elsewhere Fixed Bug36708 Problem parsing Loki's Reference TypeTraits.h Fixed Bug36690 Problem parsing Loki's Reference Functor.h Implementation Fixed Bug36692 Problem parsing Loki's Reference Singleton.h Impl Fixed Bug36703 Problem parsing Loki's Reference TypeInfo.h Impl Fixed Bug36689 Problem parsing Loki's Reference AbstractFactory.h Impl Fixed Bug36707 Problem parsing Loki's Reference TypeManip.h TESTS Updated DOMTests::testBug36247(). Moved testBug36692(), testBug36703(), testBug36708(), testBug36707(), testBug36689() and testBug36690() from DOMFailedTests to DOMTests and updated them.
This commit is contained in:
parent
20ddc794c8
commit
30b5b45010
11 changed files with 469 additions and 152 deletions
|
@ -10,7 +10,6 @@ import org.eclipse.cdt.internal.core.parser.Token;
|
|||
*/
|
||||
public class DOMBuilder implements IParserCallback
|
||||
{
|
||||
|
||||
protected DOMBuilder()
|
||||
{
|
||||
}
|
||||
|
@ -913,5 +912,11 @@ public class DOMBuilder implements IParserCallback
|
|||
protected Name currName;
|
||||
protected IParser parser = null;
|
||||
protected TranslationUnit translationUnit;
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionName(java.lang.Object)
|
||||
*/
|
||||
public void expressionName(Object expression) {
|
||||
Expression e = (Expression)expression;
|
||||
e.add( currName ); }
|
||||
|
||||
}
|
|
@ -30,7 +30,12 @@ public class Expression {
|
|||
tokens.add( t );
|
||||
}
|
||||
|
||||
public List tokens()
|
||||
public void add( Name t )
|
||||
{
|
||||
tokens.add( t );
|
||||
}
|
||||
|
||||
public List elements()
|
||||
{
|
||||
return Collections.unmodifiableList( tokens );
|
||||
}
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
<<<<<<< ChangeLog
|
||||
2003-04-20 John Camelon
|
||||
Fixed Bug36551 Bad parse on attached file.
|
||||
Partial Fix for Bug36631 remove linear search algorithm from OffsetMapping
|
||||
Some debunking of line numbers.
|
||||
2003-04-21 John Camelon
|
||||
Revisited bug36247 Parser confused by symbols #defined elsewhere
|
||||
Fixed Bug36708 Problem parsing Loki's Reference TypeTraits.h
|
||||
Fixed Bug36690 Problem parsing Loki's Reference Functor.h Implementation
|
||||
Fixed Bug36692 Problem parsing Loki's Reference Singleton.h Impl
|
||||
Fixed Bug36703 Problem parsing Loki's Reference TypeInfo.h Impl
|
||||
Fixed Bug36689 Problem parsing Loki's Reference AbstractFactory.h Implementation
|
||||
Fixed Bug36707 Problem parsing Loki's Reference TypeManip.h
|
||||
|
||||
=======
|
||||
2003-04-21 Andrew Niefer
|
||||
Fixed Bug36475 - Scanner does not concatenate strings
|
||||
Fixed Bug36509 - Scanner turns strings into identifiers when expanding macros
|
||||
Fixed Bug36521 - Scanner gets confused over commas in function like macros
|
||||
Fixed Bug36695 - Scanner looses escaping on chars (ie '\4' to '4')
|
||||
|
||||
>>>>>>> 1.34
|
||||
2003-04-20 John Camelon
|
||||
Fixed Bug36551 Bad parse on attached file.
|
||||
Partial Fix for Bug36631 remove linear search algorithm from OffsetMapping
|
||||
Some debunking of line numbers.
|
||||
|
||||
2003-04-17 John Camelon
|
||||
Fixed error in Elaborated Enumeration Types.
|
||||
Fixed Bug36559 - Parsing Templates...
|
||||
|
|
|
@ -13,6 +13,8 @@ package org.eclipse.cdt.internal.core.parser;
|
|||
import java.util.EmptyStackException;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.eclipse.cdt.internal.core.dom.Name;
|
||||
|
||||
public class ExpressionEvaluator implements IParserCallback {
|
||||
|
||||
public class ExpressionException extends Exception {
|
||||
|
@ -21,6 +23,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private Stack stack = new Stack();
|
||||
|
||||
private int popInt() {
|
||||
|
@ -163,16 +166,6 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
*/
|
||||
public void simpleDeclSpecifier(Object Container, Token specifier) {
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#nameBegin(org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void nameBegin(Token firstToken) {
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#nameEnd(org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void nameEnd(Token lastToken) {
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorBegin(java.lang.Object)
|
||||
*/
|
||||
|
@ -701,4 +694,27 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
*/
|
||||
public void setParser(IParser parser) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionName(java.lang.Object)
|
||||
*/
|
||||
public void expressionName(Object expression) {
|
||||
stack.push( currName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#nameBegin(org.eclipse.cdt.internal.core.newparser.Token)
|
||||
*/
|
||||
public void nameBegin(Token firstToken) {
|
||||
currName = new Name(firstToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#nameEnd(org.eclipse.cdt.internal.core.newparser.Token)
|
||||
*/
|
||||
public void nameEnd(Token lastToken) {
|
||||
currName.setEnd(lastToken);
|
||||
}
|
||||
|
||||
Name currName = null;
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ public interface IParserCallback {
|
|||
public Object expressionBegin( Object container );
|
||||
public void expressionOperator(Object expression, Token operator);
|
||||
public void expressionTerminal(Object expression, Token terminal);
|
||||
public void expressionName( Object expression );
|
||||
public void expressionAbort( Object expression );
|
||||
public void expressionEnd(Object expression );
|
||||
|
||||
|
|
|
@ -616,4 +616,10 @@ public class NullParserCallback implements IParserCallback {
|
|||
public void setParser(IParser parser) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionName(java.lang.Object)
|
||||
*/
|
||||
public void expressionName(Object expression) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -707,6 +707,7 @@ c, quick);
|
|||
protected void declSpecifierSeq( Object decl, boolean parm ) throws Backtrack {
|
||||
boolean encounteredTypename = false;
|
||||
boolean encounteredRawType = false;
|
||||
boolean modifierEncountered = false;
|
||||
declSpecifiers:
|
||||
for (;;) {
|
||||
switch (LT(1)) {
|
||||
|
@ -722,6 +723,7 @@ c, quick);
|
|||
case Token.t_friend:
|
||||
case Token.t_const:
|
||||
case Token.t_volatile:
|
||||
modifierEncountered = true;
|
||||
try{ callback.simpleDeclSpecifier(decl, consume());} catch( Exception e ) {}
|
||||
break;
|
||||
case Token.t_signed:
|
||||
|
@ -739,19 +741,20 @@ c, quick);
|
|||
try{ callback.simpleDeclSpecifier(decl, consume());} catch( Exception e ) {}
|
||||
break;
|
||||
case Token.t_typename:
|
||||
consume( Token.t_typename );
|
||||
try{ callback.simpleDeclSpecifier(decl, consume( Token.t_typename ));} catch( Exception e ) {}
|
||||
name();
|
||||
break;
|
||||
try{ callback.simpleDeclSpecifierName( decl );} catch( Exception e ) {}
|
||||
return;
|
||||
case Token.tCOLONCOLON:
|
||||
consume( Token.tCOLONCOLON );
|
||||
// handle nested later:
|
||||
case Token.tIDENTIFIER:
|
||||
// TODO - Kludgy way to handle constructors/destructors
|
||||
// handle nested later:
|
||||
if ((parm && !encounteredRawType) || (!encounteredRawType && LT(2) != Token.tCOLONCOLON && LT(2) != Token.tLPAREN))
|
||||
if ((modifierEncountered && ! encounteredRawType && LT(2) != Token.tLPAREN)|| (parm && !encounteredRawType) || (!encounteredRawType && LT(2) != Token.tCOLONCOLON && LT(2) != Token.tLPAREN))
|
||||
{
|
||||
if( ! encounteredTypename || ( LT(2) == Token.tIDENTIFIER &&
|
||||
( LT(3) == Token.tLPAREN || LT(3) == Token.tASSIGN ) || LT(2) == Token.tSTAR ) )
|
||||
( LT(3) == Token.tLPAREN || LT(3) == Token.tASSIGN ) || LT(2) == Token.tSTAR || LT(2) == Token.tAMPER ) )
|
||||
{
|
||||
try{ callback.simpleDeclSpecifier(decl,LA(1));} catch( Exception e ) {}
|
||||
name();
|
||||
|
@ -2010,6 +2013,11 @@ c, quick);
|
|||
callback.nameEnd( end );
|
||||
} catch( Exception e ) {}
|
||||
}
|
||||
else if( LT(1) == Token.t_typename )
|
||||
{
|
||||
consume( Token.t_typename );
|
||||
name();
|
||||
}
|
||||
else
|
||||
throw backtrack;
|
||||
}
|
||||
|
@ -2059,10 +2067,19 @@ c, quick);
|
|||
return;
|
||||
case Token.t_sizeof:
|
||||
consume(Token.t_sizeof);
|
||||
Token mark = LA(1);
|
||||
if (LT(1) == Token.tLPAREN) {
|
||||
consume( Token.tLPAREN );
|
||||
typeId();
|
||||
consume(Token.tRPAREN);
|
||||
try
|
||||
{
|
||||
consume( Token.tLPAREN );
|
||||
typeId();
|
||||
consume(Token.tRPAREN);
|
||||
}
|
||||
catch( Backtrack bt )
|
||||
{
|
||||
backup( mark );
|
||||
unaryExpression( expression );
|
||||
}
|
||||
} else {
|
||||
unaryExpression( expression );
|
||||
}
|
||||
|
@ -2168,7 +2185,8 @@ c, quick);
|
|||
return;
|
||||
|
||||
case Token.tIDENTIFIER:
|
||||
try{ callback.expressionTerminal(expression, consume());} catch( Exception e ) {}
|
||||
name();
|
||||
try{ callback.expressionName(expression);} catch( Exception e ) {}
|
||||
return;
|
||||
case Token.t_this:
|
||||
consume();
|
||||
|
|
|
@ -1,3 +1,205 @@
|
|||
<<<<<<< ChangeLog
|
||||
2003-04-21 John Camelon
|
||||
Updated DOMTests::testBug36247().
|
||||
Moved testBug36692(), testBug36703(), testBug36708(), testBug36707(), testBug36689()
|
||||
and testBug36690() from DOMFailedTests to DOMTests and updated them.
|
||||
|
||||
2003-04-20 John Camelon
|
||||
Added DOMTests::testBug36551().
|
||||
Adjusted AutomatedTest to turn on line numbering.
|
||||
Added DOMFailedTests and 11 failed test cases.
|
||||
|
||||
2003-04-17 Andrew Niefer
|
||||
Added ScannerTestCase::testBug36695()
|
||||
Moved ScannerFailedTest::testBug36521 to ScannerTestCase::testBug36521()
|
||||
Moved ScannerFailedTest::testBug36509 to ScannerTestCase::testBug36509()
|
||||
Moved ScannerFailedTest::testBug36475 to ScannerTestCase::testBug36475()
|
||||
Updated ScannerTestCase::testBug36047
|
||||
Updated ScannerTestCase::testBug36045
|
||||
|
||||
2003-04-17 John Camelon
|
||||
Updated DOMTests::testBug36600().
|
||||
Updated LineNumberTest::testDOMLineNos().
|
||||
Added DOMTests::testBug36559().
|
||||
|
||||
2003-04-17 Andrew Niefer
|
||||
Added AutomatedTest
|
||||
Added resources.cFiles
|
||||
Added resources.cppFiles
|
||||
|
||||
2003-04-16 John Camelon
|
||||
Added DOMTests::testBug36532().
|
||||
Added DOMTests::testBug36432().
|
||||
Added DOMTests::testBug36594().
|
||||
Added DOMTests::testBug36600().
|
||||
Added DOMTests::testArrayOfPointerToFunctions().
|
||||
|
||||
2003-04-15 John Camelon
|
||||
Added ScannerTestCase::testBug36434().
|
||||
Added ScannerTestCase::testMultipleLines().
|
||||
Added ParserTestSuite.
|
||||
Added LineNumberTest.
|
||||
Updated CModelElementsTests to set the Nature of the C++ project appropriately.
|
||||
|
||||
2003-04-15 Andrew Niefer
|
||||
Moved ScannerFailedTest::testBug36047 to ScannerTestCase::testBug36047
|
||||
Added ScannerFailedTest::testBug36475
|
||||
|
||||
2003-04-13 John Camelon
|
||||
Added DOMTests::testPointersToFunctions.
|
||||
|
||||
2003-04-11 John Camelon
|
||||
Added DOMTests::testBug36247().
|
||||
|
||||
2003-04-11 Andrew Niefer
|
||||
Moved ScannerFailedTest::testBug36316 to ScannerTestCase::testBug36316
|
||||
Added ScannerFailedTest::testBug36047
|
||||
Added ScannerTestCase::testNestedRecursiveDefines
|
||||
|
||||
2003-04-10 John Camelon
|
||||
Added DOMTests::testBug36237().
|
||||
|
||||
2003-04-09 John Camelon
|
||||
Removed all the old Code Model Builder source that was no longer being used (NewModelBuilder.java, etc.).
|
||||
Moved all the files in parser.util directory to the dom.
|
||||
Organized imports.
|
||||
Added DOMTests::testTemplateDeclarationOfMethod().
|
||||
Added DOMTests::testBug36250().
|
||||
Added DOMTests::testBug36240().
|
||||
Added DOMTests::testBug36254().
|
||||
|
||||
2003-04-09 John Camelon
|
||||
Updated ScannerTest::testBug36045().
|
||||
Added ScannerTest::testBug36287().
|
||||
Added DOMTests::testBug36288().
|
||||
|
||||
2003-04-06 Andrew Niefer
|
||||
Added ParserSymbolTableTest::testOverloadRanking()
|
||||
|
||||
2003-04-04 Alain Magloire
|
||||
* src/org/eclipse/cdt/testplugin/util/VerifyDialog.java:
|
||||
Remove some warnings.
|
||||
|
||||
2003-04-03 John Camelon
|
||||
Updated ScannerTest::testSimpleIfdef() for bug36019.
|
||||
Updated ScannerTest::testNumerics() for bug36020.
|
||||
Added ScannerTest::testBug36045().
|
||||
Updated DOMTests::testTemplateDeclaration() for template grammar updates.
|
||||
|
||||
2003-04-01 Andrew Niefer
|
||||
ParserSymbolTableTest. modifications to using declaration tests to reflect changes in the
|
||||
symbol table. Also added testUserDefinedConversionSequences()
|
||||
|
||||
2003-04-01 John Camelon
|
||||
Added testBug35906() to DOMTests.
|
||||
|
||||
2003-03-31 John Camelon
|
||||
Added testStruct() to DOMTests.
|
||||
Added test35892()to ScannerTest.
|
||||
|
||||
2003-03-31 Andrew Niefer
|
||||
In ParserSymbolTableTest, renamed testFunctionResolution_2() to testFunctionResolution_PointersAndBaseClasses(),
|
||||
and modified to reflect changes in function resolution.
|
||||
Added testFunctionResolution_TypedefsAndPointers().
|
||||
|
||||
2003-03-31 John Camelon
|
||||
Added testWeirdStrings() and testNumerics() to ScannerTestCase.
|
||||
Added testTemplateSpecialization(), testTemplateDeclaration(), testBug26467(),
|
||||
testTypedef() and testTemplateInstantiation() to DOMTests.
|
||||
|
||||
2003-03-28 John Camelon
|
||||
Added testConstructorChain() and testASMDefinition() to DOMTests.
|
||||
|
||||
2003-03-27 Alain Magloire
|
||||
Changes were done in the Core Model API, the hierarchy is now
|
||||
ICModel
|
||||
ICProject
|
||||
ICContainer
|
||||
ITranslationUnit
|
||||
IArchive
|
||||
IBinary
|
||||
We adjust the tests.
|
||||
* model/org/eclipse/cdt/core/model/tests/ArchiveTests.java
|
||||
* model/org/eclipse/cdt/core/model/tests/BinaryTests.java
|
||||
* model/org/eclipse/cdt/core/model/tests/TranslationUniTests.java
|
||||
* model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java
|
||||
|
||||
2003-03-26 Andrew Niefer
|
||||
In ParserSymbolTableTest :
|
||||
updated all tests to reflect TypeInfo changes
|
||||
Added testFunctionResolution() & testFunctionResolution_2() in
|
||||
|
||||
2003-03-25 John Camelon
|
||||
Added testDeclSpecifier(), testNamespaceDefinition(), testLinkageSpecification(),
|
||||
testUsingClauses() and testEnumSpecifier() to DOMTests.
|
||||
|
||||
2003-03-23 John Camelon
|
||||
Added ptrOperator() test to DOMTests.
|
||||
Added testFunctionModifiers() test to DOMTests.
|
||||
Added testArrays() test to DOMTests.
|
||||
|
||||
2003-03-20 Alain Magloire
|
||||
|
||||
Patch from Amer Hoda, tests for the CElement deltas for Translation Units.
|
||||
* model/org/eclipse/cdt/core/model/tests/ElementDeltaTest.java
|
||||
* model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h
|
||||
|
||||
2003-03-19 Alain Magloire
|
||||
Patch from Amer Hoda, introducing a simple test for the core model.
|
||||
* model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java
|
||||
* model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h
|
||||
|
||||
2003-03-18 John Camelon
|
||||
Updated DOMTests to validate simple case of a function declaration with multiple parameters.
|
||||
* parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
|
||||
|
||||
2003-03-11 John Camelon
|
||||
Updated DOMTests for core.internal.parser change of merging DeclarationSpecifier and DeclSpecifier
|
||||
Organized imports
|
||||
* parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
|
||||
* parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
|
||||
|
||||
2003-03-10 John Camelon
|
||||
Added macro pasting tests
|
||||
|
||||
2003-03-06 Andrew Niefer
|
||||
Added tests for exercising Namespaces & using directives in new parser's symbol table
|
||||
|
||||
2003-03-04 Doug Schaefer
|
||||
This is a pretty big patch, but it is the merge of the NewParser1 branch into the HEAD branch. lder "parser")
|
||||
JUnit tests for testing various pieces (source folder "parser" in cdt.ui.tests.
|
||||
|
||||
2003-01-29 Peter Graves
|
||||
|
||||
Fixed the warnings when accessing static methods
|
||||
* src/org/eclipse/cdt/testplugin/util/DialogCheck.java:
|
||||
* src/org/eclipse/cdt/testplugin/CTestPlugin.java
|
||||
* src/org/eclipse/cdt/testplugin/TestWorkbench.java
|
||||
* ChangeLog: make all entries have the same formatting
|
||||
|
||||
2002-12-17 Peter Graves
|
||||
|
||||
* plugin.xml,test.xml: Some simple cleanups to remove refrences to the jdt and
|
||||
to move closer to automated running
|
||||
|
||||
2002-11-27 Alain Magloire
|
||||
|
||||
* model/org/eclipse/cdt/core/model/tests/CModelTests.java:
|
||||
Use CoreModel.getDefault().
|
||||
|
||||
2002-10-30 Alain Magloire
|
||||
|
||||
* model/org/eclipse/cdt/core/model/tests/CModelTests.java (testGetNatureID):
|
||||
The fields and the methods use in this test was removed from the CoreModel class.
|
||||
(testHasNature): The method use in this case was refactor in the classes
|
||||
CProjectNature and CCProjectNature, fix the test.
|
||||
|
||||
2002-10-18 Peter Graves
|
||||
|
||||
src/org/eclipse/cdt/testplugin/CProjectHelper.jada
|
||||
Cleanup of the CProjectHelper file to remove unused imports, commeted out code etc.
|
||||
|
||||
=======
|
||||
2003-04-21 Andrew Niefer
|
||||
Added DOMFailedTests::testBug36713()
|
||||
Added DOMFailedTests::testBug36714()
|
||||
|
@ -199,3 +401,4 @@
|
|||
src/org/eclipse/cdt/testplugin/CProjectHelper.jada
|
||||
Cleanup of the CProjectHelper file to remove unused imports, commeted out code etc.
|
||||
|
||||
>>>>>>> 1.36
|
||||
|
|
|
@ -32,72 +32,20 @@ public class DOMFailedTest extends DOMTests {
|
|||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite();
|
||||
|
||||
suite.addTest(new DOMFailedTest("testBug36689"));
|
||||
suite.addTest(new DOMFailedTest("testBug36690"));
|
||||
suite.addTest(new DOMFailedTest("testBug36691"));
|
||||
suite.addTest(new DOMFailedTest("testBug36692"));
|
||||
suite.addTest(new DOMFailedTest("testBug36693"));
|
||||
suite.addTest(new DOMFailedTest("testBug36696"));
|
||||
suite.addTest(new DOMFailedTest("testBug36699"));
|
||||
suite.addTest(new DOMFailedTest("testBug36703"));
|
||||
suite.addTest(new DOMFailedTest("testBug36704"));
|
||||
suite.addTest(new DOMFailedTest("testBug36707"));
|
||||
suite.addTest(new DOMFailedTest("testBug36708"));
|
||||
suite.addTest(new DOMFailedTest("testBug36713"));
|
||||
suite.addTest(new DOMFailedTest("testBug36714"));
|
||||
suite.addTest(new DOMFailedTest("testBug36717"));
|
||||
suite.addTest(new DOMFailedTest("testBug36730"));
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
||||
public void testBug36689() {
|
||||
boolean testPassed = false;
|
||||
try {
|
||||
Writer code = new StringWriter();
|
||||
code.write("template\n");
|
||||
code.write("<\n");
|
||||
code.write("class AbstractFact,\n");
|
||||
code.write(
|
||||
"template <class, class> class Creator = OpNewFactoryUnit,\n");
|
||||
code.write("class TList = typename AbstractFact::ProductList\n");
|
||||
code.write(">\n");
|
||||
code.write("class ConcreteFactory\n");
|
||||
code.write(": public GenLinearHierarchy<\n");
|
||||
code.write(
|
||||
"typename TL::Reverse<TList>::Result, Creator, AbstractFact>\n");
|
||||
code.write("{\n");
|
||||
code.write("public:\n");
|
||||
code.write(
|
||||
"typedef typename AbstractFact::ProductList ProductList;\n");
|
||||
code.write("typedef TList ConcreteProductList;\n");
|
||||
code.write("};\n");
|
||||
TranslationUnit tu = parse(code.toString());
|
||||
testPassed = true;
|
||||
} catch (Throwable e) {
|
||||
if (!(e instanceof ParserException))
|
||||
fail("Unexpected Error: " + e.getMessage());
|
||||
|
||||
if (testPassed)
|
||||
fail("The expected error did not occur.");
|
||||
}
|
||||
}
|
||||
|
||||
public void testBug36690() {
|
||||
boolean testPassed = false;
|
||||
try {
|
||||
TranslationUnit tu =
|
||||
parse("Functor(const Functor& rhs) : spImpl_(Impl::Clone(rhs.spImpl_.get())){}");
|
||||
testPassed = true;
|
||||
} catch (Throwable e) {
|
||||
if (!(e instanceof ParserException))
|
||||
fail("Unexpected Error: " + e.getMessage());
|
||||
|
||||
if (testPassed)
|
||||
fail("The expected error did not occur.");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void testBug36691() {
|
||||
boolean testPassed = false;
|
||||
try {
|
||||
|
@ -108,6 +56,7 @@ public class DOMFailedTest extends DOMTests {
|
|||
code.write("{ return obj; }\n");
|
||||
TranslationUnit tu = parse(code.toString());
|
||||
testPassed = true;
|
||||
fail( "We should not reach this point");
|
||||
} catch (Throwable e) {
|
||||
if (!(e instanceof ParserException))
|
||||
fail("Unexpected Error: " + e.getMessage());
|
||||
|
@ -117,33 +66,13 @@ public class DOMFailedTest extends DOMTests {
|
|||
}
|
||||
}
|
||||
|
||||
public void testBug36692() {
|
||||
boolean testPassed = false;
|
||||
try {
|
||||
Writer code = new StringWriter();
|
||||
code.write("template <typename T, typename Destroyer>\n");
|
||||
code.write(
|
||||
"void SetLongevity(T* pDynObject, unsigned int longevity,\n");
|
||||
code.write("Destroyer d = Private::Deleter<T>::Delete){}\n");
|
||||
|
||||
TranslationUnit tu = parse(code.toString());
|
||||
testPassed = true;
|
||||
} catch (Throwable e) {
|
||||
if (!(e instanceof ParserException))
|
||||
fail("Unexpected Error: " + e.getMessage());
|
||||
|
||||
if (testPassed)
|
||||
fail("The expected error did not occur.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testBug36693() {
|
||||
boolean testPassed = false;
|
||||
try {
|
||||
TranslationUnit tu =
|
||||
parse("FixedAllocator::Chunk* FixedAllocator::VicinityFind(void* p){}");
|
||||
testPassed = true;
|
||||
fail( "We should not reach this point");
|
||||
} catch (Throwable e) {
|
||||
if (!(e instanceof ParserException))
|
||||
fail("Unexpected Error: " + e.getMessage());
|
||||
|
@ -163,6 +92,7 @@ public class DOMFailedTest extends DOMTests {
|
|||
": pCount_(reinterpret_cast<const RefCounted&>(rhs).pCount_) {}\n");
|
||||
TranslationUnit tu = parse(code.toString());
|
||||
testPassed = true;
|
||||
fail( "We should not reach this point");
|
||||
} catch (Throwable e) {
|
||||
if (!(e instanceof ParserException))
|
||||
fail("Unexpected Error: " + e.getMessage());
|
||||
|
@ -187,20 +117,7 @@ public class DOMFailedTest extends DOMTests {
|
|||
code.write("{};\n");
|
||||
TranslationUnit tu = parse(code.toString());
|
||||
testPassed = true;
|
||||
} catch (Throwable e) {
|
||||
if (!(e instanceof ParserException))
|
||||
fail("Unexpected Error: " + e.getMessage());
|
||||
|
||||
if (testPassed)
|
||||
fail("The expected error did not occur.");
|
||||
}
|
||||
}
|
||||
|
||||
public void testBug36703() {
|
||||
boolean testPassed = false;
|
||||
try {
|
||||
TranslationUnit tu = parse("const std::type_info& Get() const;");
|
||||
testPassed = true;
|
||||
fail( "We should not reach this point");
|
||||
} catch (Throwable e) {
|
||||
if (!(e instanceof ParserException))
|
||||
fail("Unexpected Error: " + e.getMessage());
|
||||
|
@ -216,6 +133,7 @@ public class DOMFailedTest extends DOMTests {
|
|||
TranslationUnit tu =
|
||||
parse("template <class T, class U> struct Length< Typelist<T, U> > { enum { value = 1 + Length<U>::value };};);");
|
||||
testPassed = true;
|
||||
fail( "We should not reach this point");
|
||||
} catch (Throwable e) {
|
||||
if (!(e instanceof ParserException))
|
||||
fail("Unexpected Error: " + e.getMessage());
|
||||
|
@ -289,21 +207,6 @@ public class DOMFailedTest extends DOMTests {
|
|||
fail( "The expected error did not occur.");
|
||||
}
|
||||
|
||||
public void testBug36717(){
|
||||
boolean testPassed = false;
|
||||
try{
|
||||
TranslationUnit tu =
|
||||
parse("enum { eA = A::b };");
|
||||
|
||||
testPassed = true;
|
||||
} catch (Throwable e ) {
|
||||
if( ! (e instanceof ParserException))
|
||||
fail( "Unexpected Error: " + e.getMessage() );
|
||||
}
|
||||
if( testPassed )
|
||||
fail( "The expected error did not occur.");
|
||||
}
|
||||
|
||||
public void testBug36730(){
|
||||
boolean testPassed = false;
|
||||
try{
|
||||
|
@ -317,4 +220,5 @@ public class DOMFailedTest extends DOMTests {
|
|||
if( testPassed )
|
||||
fail( "The expected error did not occur.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -123,7 +123,6 @@ public class CModelElementsTests extends TestCase {
|
|||
INamespace namespace = (INamespace) tuPackages.get(0);
|
||||
assertEquals(namespace.getElementName(), new String("MyPackage"));
|
||||
checkLineNumbers((CElement)namespace, 8, 121);
|
||||
|
||||
checkClass(namespace);
|
||||
|
||||
checkEnums(namespace);
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.eclipse.cdt.internal.core.dom.PointerOperator;
|
|||
import org.eclipse.cdt.internal.core.dom.SimpleDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.TemplateDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.TemplateParameter;
|
||||
import org.eclipse.cdt.internal.core.dom.TemplateParameterList;
|
||||
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
|
||||
import org.eclipse.cdt.internal.core.dom.UsingDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.UsingDirective;
|
||||
|
@ -371,8 +372,8 @@ public class DOMTests extends TestCase {
|
|||
|
||||
Expression exp = declarator.getExpression();
|
||||
assertNotNull( exp );
|
||||
assertEquals( 1, exp.tokens().size() );
|
||||
Token t = (Token)exp.tokens().get(0);
|
||||
assertEquals( 1, exp.elements().size() );
|
||||
Token t = (Token)exp.elements().get(0);
|
||||
assertEquals( t.getImage(), "5" );
|
||||
assertEquals( t.getType(), Token.tINTEGER);
|
||||
}
|
||||
|
@ -588,10 +589,10 @@ public class DOMTests extends TestCase {
|
|||
Declarator parm1Declarator = (Declarator) parm1Decls.get(0);
|
||||
assertEquals( "parm1", parm1Declarator.getName().toString() );
|
||||
Expression initialValueParm1 = parm1Declarator.getExpression();
|
||||
assertEquals( initialValueParm1.tokens().size(), 3 );
|
||||
Token t1 = (Token)initialValueParm1.tokens().get( 0 );
|
||||
Token t2 = (Token)initialValueParm1.tokens().get( 1 );
|
||||
Token t3 = (Token)initialValueParm1.tokens().get( 2 );
|
||||
assertEquals( initialValueParm1.elements().size(), 3 );
|
||||
Token t1 = (Token)initialValueParm1.elements().get( 0 );
|
||||
Token t2 = (Token)initialValueParm1.elements().get( 1 );
|
||||
Token t3 = (Token)initialValueParm1.elements().get( 2 );
|
||||
assertEquals( t1.getType(), Token.tINTEGER );
|
||||
assertEquals( t1.getImage(), "3" );
|
||||
assertEquals( t3.getType(), Token.tSTAR );
|
||||
|
@ -692,7 +693,7 @@ public class DOMTests extends TestCase {
|
|||
assertEquals( 2, arrayQualifiers.size() );
|
||||
ArrayQualifier q1 =(ArrayQualifier)arrayQualifiers.get(0);
|
||||
assertNotNull( q1.getExpression() );
|
||||
List tokens = q1.getExpression().tokens();
|
||||
List tokens = q1.getExpression().elements();
|
||||
assertEquals( tokens.size(), 1 );
|
||||
ArrayQualifier q2 =(ArrayQualifier)arrayQualifiers.get(1);
|
||||
assertNull( q2.getExpression() );
|
||||
|
@ -802,7 +803,7 @@ public class DOMTests extends TestCase {
|
|||
Declarator declarator1 = (Declarator)decl1.getDeclarators().get( 0 );
|
||||
assertEquals( declarator1.getName().toString(), "x" );
|
||||
Expression initValue1 = declarator1.getExpression();
|
||||
assertEquals( initValue1.tokens().size(), 1 );
|
||||
assertEquals( initValue1.elements().size(), 1 );
|
||||
List ptrOps1 = declarator1.getPointerOperators();
|
||||
assertNotNull( ptrOps1 );
|
||||
assertEquals( 1, ptrOps1.size() );
|
||||
|
@ -811,7 +812,7 @@ public class DOMTests extends TestCase {
|
|||
assertFalse( po1.isConst() );
|
||||
assertFalse( po1.isVolatile() );
|
||||
assertEquals( po1.getType(), PointerOperator.t_pointer );
|
||||
Token t1 = (Token)initValue1.tokens().get(0);
|
||||
Token t1 = (Token)initValue1.elements().get(0);
|
||||
assertEquals( t1.getType(), Token.tINTEGER );
|
||||
assertEquals( t1.getImage(), "0");
|
||||
|
||||
|
@ -933,24 +934,22 @@ public class DOMTests extends TestCase {
|
|||
List expressions1_1 = element1_1.getExpressionList();
|
||||
assertEquals( expressions1_1.size(), 2 );
|
||||
ConstructorChainElementExpression expression1_1_1 = (ConstructorChainElementExpression)expressions1_1.get(0);
|
||||
assertEquals( expression1_1_1.getExpression().tokens().size(), 1 );
|
||||
Token t1_1_1 = (Token)expression1_1_1.getExpression().tokens().get(0);
|
||||
assertEquals( expression1_1_1.getExpression().elements().size(), 1 );
|
||||
Name t1_1_1 = (Name)expression1_1_1.getExpression().elements().get(0);
|
||||
ConstructorChainElementExpression expression1_1_2 = (ConstructorChainElementExpression)expressions1_1.get(1);
|
||||
assertEquals( expression1_1_2.getExpression().tokens().size(), 1 );
|
||||
Token t1_1_2 = (Token)expression1_1_2.getExpression().tokens().get(0);
|
||||
assertEquals( expression1_1_2.getExpression().elements().size(), 1 );
|
||||
Name t1_1_2 = (Name)expression1_1_2.getExpression().elements().get(0);
|
||||
|
||||
assertEquals( t1_1_1.getType(), Token.tIDENTIFIER );
|
||||
assertEquals( t1_1_1.getImage(), "rtg_rts");
|
||||
assertEquals( t1_1_2.getType(), Token.tIDENTIFIER );
|
||||
assertEquals( t1_1_2.getImage(), "rtg_ref");
|
||||
assertEquals( t1_1_1.toString(), "rtg_rts");
|
||||
assertEquals( t1_1_2.toString(), "rtg_ref");
|
||||
|
||||
ConstructorChainElement element1_2 = (ConstructorChainElement) chainElements1.get(1);
|
||||
assertEquals( element1_2.getName().toString(), "myId" );
|
||||
List expressions1_2 = element1_2.getExpressionList();
|
||||
assertEquals( expressions1_2.size(), 1 );
|
||||
ConstructorChainElementExpression expression = (ConstructorChainElementExpression) expressions1_2.get(0);
|
||||
assertEquals( expression.getExpression().tokens().size(), 1 );
|
||||
Token t = (Token)expression.getExpression().tokens().get(0);
|
||||
assertEquals( expression.getExpression().elements().size(), 1 );
|
||||
Token t = (Token)expression.getExpression().elements().get(0);
|
||||
assertEquals( t.getImage(), "0");
|
||||
assertEquals( t.getType(), Token.tINTEGER );
|
||||
|
||||
|
@ -1340,6 +1339,7 @@ public class DOMTests extends TestCase {
|
|||
code.write( "INLINE_DEF int f ();\n" );
|
||||
code.write( "INLINE_DEF A g ();" );
|
||||
code.write( "INLINE_DEF A * h ();" );
|
||||
code.write( "INLINE_DEF A & unlock( void );");
|
||||
code.write( "};" );
|
||||
TranslationUnit tu = parse(code.toString());
|
||||
assertEquals( tu.getDeclarations().size(),1 );
|
||||
|
@ -1348,7 +1348,7 @@ public class DOMTests extends TestCase {
|
|||
assertEquals( classDeclaration.getDeclSpecifier().getType(), DeclSpecifier.t_type );
|
||||
ClassSpecifier classSpec = (ClassSpecifier)classDeclaration.getTypeSpecifier();
|
||||
PointerOperator po =null;
|
||||
int number = 3;
|
||||
int number = 4;
|
||||
assertEquals( classSpec.getDeclarations().size(), number );
|
||||
for( int i = 0; i < number; ++i )
|
||||
{
|
||||
|
@ -1356,7 +1356,10 @@ public class DOMTests extends TestCase {
|
|||
assertEquals( subDeclaration.getDeclarators().size(), 1 );
|
||||
Declarator functionDeclarator = (Declarator)subDeclaration.getDeclarators().get(0);
|
||||
assertNotNull( functionDeclarator.getParms());
|
||||
assertEquals( 0, functionDeclarator.getParms().getDeclarations().size() );
|
||||
if( i == 3)
|
||||
assertEquals( 1, functionDeclarator.getParms().getDeclarations().size() );
|
||||
else
|
||||
assertEquals( 0, functionDeclarator.getParms().getDeclarations().size() );
|
||||
List pointerOperators = functionDeclarator.getPointerOperators();
|
||||
switch( i )
|
||||
{
|
||||
|
@ -1381,6 +1384,15 @@ public class DOMTests extends TestCase {
|
|||
assertFalse( po.isVolatile() );
|
||||
assertEquals( po.getType(), PointerOperator.t_pointer );
|
||||
break;
|
||||
case 3:
|
||||
assertEquals( subDeclaration.getDeclSpecifier().getType(), DeclSpecifier.t_type );
|
||||
assertEquals( subDeclaration.getDeclSpecifier().getTypeName(), "A");
|
||||
assertEquals( functionDeclarator.getName().toString(), "unlock" );
|
||||
assertEquals( pointerOperators.size(), 1 );
|
||||
po = (PointerOperator)pointerOperators.get(0);
|
||||
assertFalse( po.isConst() );
|
||||
assertFalse( po.isVolatile() );
|
||||
assertEquals( po.getType(), PointerOperator.t_reference );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1461,5 +1473,147 @@ public class DOMTests extends TestCase {
|
|||
assertEquals( ls.getDeclarations().size(), 0);
|
||||
assertEquals( ls.getLanguageLinkage(), "C" );
|
||||
}
|
||||
|
||||
public void testBug36692() throws Exception {
|
||||
Writer code = new StringWriter();
|
||||
code.write("template <typename T, typename Destroyer>\n");
|
||||
code.write("void SetLongevity(T* pDynObject, unsigned int longevity,\n");
|
||||
code.write("Destroyer d = Private::Deleter<T>::Delete){}\n");
|
||||
|
||||
TranslationUnit tu = parse(code.toString());
|
||||
assertEquals( tu.getDeclarations().size(), 1 );
|
||||
TemplateDeclaration template = (TemplateDeclaration)tu.getDeclarations().get(0);
|
||||
assertFalse( template.isExported() );
|
||||
TemplateParameterList list = template.getTemplateParms();
|
||||
assertEquals( list.getDeclarations().size(), 2 );
|
||||
for( int i = 0; i < 2; ++i )
|
||||
{
|
||||
TemplateParameter parameter = (TemplateParameter)list.getDeclarations().get(i);
|
||||
assertEquals( parameter.getName().toString(), i == 0 ? "T": "Destroyer");
|
||||
assertEquals( parameter.getKind(), TemplateParameter.k_typename );
|
||||
}
|
||||
assertEquals( template.getDeclarations().size(), 1 );
|
||||
SimpleDeclaration method = (SimpleDeclaration)template.getDeclarations().get(0);
|
||||
assertEquals( method.getDeclSpecifier().getType(), DeclSpecifier.t_void );
|
||||
assertEquals( method.getDeclarators().size(), 1 );
|
||||
assertEquals( method.isFunctionDefinition(), true );
|
||||
Declarator declarator = (Declarator)method.getDeclarators().get(0);
|
||||
assertEquals( declarator.getName().toString(), "SetLongevity");
|
||||
ParameterDeclarationClause pdc = declarator.getParms();
|
||||
assertEquals( pdc.getDeclarations().size(), 3 );
|
||||
for( int i = 0; i < 3; ++i )
|
||||
{
|
||||
ParameterDeclaration parameter = (ParameterDeclaration)pdc.getDeclarations().get(i);
|
||||
assertEquals( parameter.getDeclarators().size(), 1 );
|
||||
Declarator parameterDeclarator = (Declarator)parameter.getDeclarators().get(0);
|
||||
List pointers = parameterDeclarator.getPointerOperators();
|
||||
PointerOperator op = null;
|
||||
Expression exp = parameterDeclarator.getExpression();
|
||||
switch( i )
|
||||
{
|
||||
case 0:
|
||||
assertEquals( parameterDeclarator.getName().toString(), "pDynObject");
|
||||
assertEquals( pointers.size(), 1 );
|
||||
op = (PointerOperator)pointers.get(0);
|
||||
assertFalse( op.isConst());
|
||||
assertFalse( op.isVolatile());
|
||||
assertEquals( op.getType(), PointerOperator.t_pointer);
|
||||
assertNull( exp );
|
||||
break;
|
||||
case 1:
|
||||
assertEquals( parameterDeclarator.getName().toString(), "longevity");
|
||||
assertEquals( pointers.size(), 0 );
|
||||
assertEquals( parameter.getDeclSpecifier().getType(), DeclSpecifier.t_int );
|
||||
assertTrue( parameter.getDeclSpecifier().isUnsigned() );
|
||||
assertNull( exp );
|
||||
break;
|
||||
case 2:
|
||||
assertEquals( parameterDeclarator.getName().toString(), "d");
|
||||
assertEquals( pointers.size(), 0 );
|
||||
assertNotNull( exp );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testBug36708() throws Exception {
|
||||
TranslationUnit tu = parse("enum { isPointer = PointerTraits<T>::result };");
|
||||
assertEquals( tu.getDeclarations().size(), 1 );
|
||||
SimpleDeclaration simple = (SimpleDeclaration)tu.getDeclarations().get(0);
|
||||
assertEquals( simple.getDeclarators().size(), 0 );
|
||||
EnumerationSpecifier enum = (EnumerationSpecifier)simple.getTypeSpecifier();
|
||||
assertNull( enum.getName() );
|
||||
List enumerators = enum.getEnumeratorDefinitions();
|
||||
assertEquals( enumerators.size(), 1 );
|
||||
EnumeratorDefinition enumerator = (EnumeratorDefinition )enumerators.get(0);
|
||||
assertEquals( enumerator.getName().toString(), "isPointer");
|
||||
assertNotNull( enumerator.getExpression() );
|
||||
}
|
||||
|
||||
public void testBug36690() throws Exception {
|
||||
TranslationUnit tu = parse("Functor(const Functor& rhs) : spImpl_(Impl::Clone(rhs.spImpl_.get())){}");
|
||||
assertEquals( tu.getDeclarations().size(), 1 );
|
||||
SimpleDeclaration simple = (SimpleDeclaration)tu.getDeclarations().get(0);
|
||||
assertEquals( simple.getDeclarators().size(), 1 );
|
||||
Declarator declarator = (Declarator)simple.getDeclarators().get(0);
|
||||
ParameterDeclarationClause pdc = declarator.getParms();
|
||||
assertEquals( pdc.getDeclarations().size(), 1 );
|
||||
ConstructorChain chain = declarator.getCtorChain();
|
||||
assertEquals( chain.getChainElements().size(), 1 );
|
||||
}
|
||||
|
||||
public void testBug36703() throws Exception {
|
||||
TranslationUnit tu = parse("const std::type_info& Get() const;");
|
||||
assertEquals( tu.getDeclarations().size(), 1 );
|
||||
SimpleDeclaration simple = (SimpleDeclaration)tu.getDeclarations().get(0);
|
||||
assertEquals( simple.getDeclSpecifier().isConst(), true );
|
||||
assertEquals( simple.getDeclSpecifier().getType(), DeclSpecifier.t_type);
|
||||
assertEquals( simple.getDeclSpecifier().getTypeName(), "std::type_info");
|
||||
assertEquals( simple.getDeclarators().size(), 1 );
|
||||
Declarator declarator = (Declarator)simple.getDeclarators().get(0);
|
||||
ParameterDeclarationClause pdc = declarator.getParms();
|
||||
assertTrue( declarator.isConst() );
|
||||
assertEquals( pdc.getDeclarations().size(), 0 );
|
||||
assertEquals( declarator.getName().toString(), "Get");
|
||||
assertEquals( declarator.getPointerOperators().size(), 1 );
|
||||
PointerOperator pointerOperator = (PointerOperator)declarator.getPointerOperators().get(0);
|
||||
assertFalse( pointerOperator.isConst());
|
||||
assertFalse( pointerOperator.isVolatile());
|
||||
assertEquals( pointerOperator.getType(), PointerOperator.t_reference);
|
||||
}
|
||||
|
||||
public void testBug36689() throws Exception {
|
||||
Writer code = new StringWriter();
|
||||
code.write("template\n");
|
||||
code.write("<\n");
|
||||
code.write("class AbstractFact,\n");
|
||||
code.write(
|
||||
"template <class, class> class Creator = OpNewFactoryUnit,\n");
|
||||
code.write("class TList = typename AbstractFact::ProductList\n");
|
||||
code.write(">\n");
|
||||
code.write("class ConcreteFactory\n");
|
||||
code.write(": public GenLinearHierarchy<\n");
|
||||
code.write(
|
||||
"typename TL::Reverse<TList>::Result, Creator, AbstractFact>\n");
|
||||
code.write("{\n");
|
||||
code.write("public:\n");
|
||||
code.write(
|
||||
"typedef typename AbstractFact::ProductList ProductList;\n");
|
||||
code.write("typedef TList ConcreteProductList;\n");
|
||||
code.write("};\n");
|
||||
TranslationUnit tu = parse(code.toString());
|
||||
}
|
||||
|
||||
public void testBug36707() throws Exception {
|
||||
TranslationUnit tu =
|
||||
parse("enum { exists = sizeof(typename H::Small) == sizeof((H::Test(H::MakeT()))) };");
|
||||
}
|
||||
|
||||
public void testBug36717() throws Exception {
|
||||
TranslationUnit tu = parse("enum { eA = A::b };");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue