mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
CORE
Partial fix for Bug 36932 - RTS: Parser fails on "new" in ctor initializer Fixed Bug 36704 - Problem parsing Loki's Reference Typelist.h Fixed Bug 36699 - Problem parsing Loki's Reference SmartPtr.h Impl Fixed Bug 36691 - Problem parsing Loki's Reference HierarchyGenerators.h Impl TESTS Added testBug36932() to DOMTests. Moved testBugFunctor758() from LokiFailures to DOMTests. Moved testBug36704() from DOMFailedTest to DOMTests. Moved testBug36699() from DOMFailedTest to DOMTests. Moved testBug36691() from DOMFailedTest to DOMTests.
This commit is contained in:
parent
4d93d6c4df
commit
1c7ed5ec08
6 changed files with 163 additions and 59 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-04-27 John Camelon
|
||||
Partial fix for Bug 36932 - RTS: Parser fails on "new" in ctor initializer
|
||||
Fixed Bug 36704 - Problem parsing Loki's Reference Typelist.h
|
||||
Fixed Bug 36699 - Problem parsing Loki's Reference SmartPtr.h Impl
|
||||
Fixed Bug 36691 - Problem parsing Loki's Reference HierarchyGenerators.h Impl
|
||||
|
||||
2003-04-25 Andrew Niefer
|
||||
Fixed bug36771 - Outline view shows include with no name
|
||||
Fixed bug36714 - Parser fails on initial assignment using floating-suffix
|
||||
|
|
|
@ -861,7 +861,23 @@ c, quick);
|
|||
break;
|
||||
case Token.t_typename:
|
||||
try{ callback.simpleDeclSpecifier(decl, consume( Token.t_typename ));} catch( Exception e ) {}
|
||||
Token first = LA(1);
|
||||
Token last = null;
|
||||
name();
|
||||
if( LT(1) == Token.t_template )
|
||||
{
|
||||
consume( Token.t_template );
|
||||
last = templateId();
|
||||
try
|
||||
{
|
||||
callback.nameBegin( first );
|
||||
callback.nameEnd( last );
|
||||
}
|
||||
catch( Exception e ) { }
|
||||
|
||||
|
||||
}
|
||||
|
||||
try{ callback.simpleDeclSpecifierName( decl );} catch( Exception e ) {}
|
||||
return;
|
||||
case Token.tCOLONCOLON:
|
||||
|
@ -872,6 +888,8 @@ c, quick);
|
|||
// handle nested later:
|
||||
if ( flags.haveEncounteredRawType() )
|
||||
return;
|
||||
if( parm && flags.haveEncounteredTypename() )
|
||||
return;
|
||||
if ( lookAheadForConstructor( flags ) )
|
||||
return;
|
||||
if ( lookAheadForDeclarator( flags ) )
|
||||
|
@ -962,32 +980,11 @@ c, quick);
|
|||
*/
|
||||
protected void className() throws Backtrack
|
||||
{
|
||||
Token first = LA(1);
|
||||
if( LT(1) == Token.tIDENTIFIER)
|
||||
{
|
||||
if( LT(2) == Token.tLT )
|
||||
{
|
||||
consume( Token.tIDENTIFIER );
|
||||
consume( Token.tLT );
|
||||
|
||||
// until we get all the names sorted out
|
||||
int depth = 1;
|
||||
Token last = null;
|
||||
|
||||
while (depth > 0) {
|
||||
last = consume();
|
||||
switch ( last.getType()) {
|
||||
case Token.tGT:
|
||||
--depth;
|
||||
break;
|
||||
case Token.tLT:
|
||||
++depth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
callback.nameBegin( first );
|
||||
callback.nameEnd( last );
|
||||
templateId();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -998,6 +995,31 @@ c, quick);
|
|||
else
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
protected Token templateId() throws Backtrack, EndOfFile {
|
||||
Token first = consume( Token.tIDENTIFIER );
|
||||
consume( Token.tLT );
|
||||
|
||||
// until we get all the names sorted out
|
||||
int depth = 1;
|
||||
Token last = null;
|
||||
|
||||
while (depth > 0) {
|
||||
last = consume();
|
||||
switch ( last.getType()) {
|
||||
case Token.tGT:
|
||||
--depth;
|
||||
break;
|
||||
case Token.tLT:
|
||||
++depth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
callback.nameBegin( first );
|
||||
callback.nameEnd( last );
|
||||
return last;
|
||||
}
|
||||
|
||||
/**
|
||||
* name
|
||||
|
@ -1055,6 +1077,9 @@ c, quick);
|
|||
while (LT(1) == Token.tCOLONCOLON) {
|
||||
last = consume();
|
||||
|
||||
if (LT(1) == Token.t_template )
|
||||
consume();
|
||||
|
||||
if (LT(1) == Token.tCOMPL)
|
||||
consume();
|
||||
|
||||
|
@ -2013,9 +2038,22 @@ c, quick);
|
|||
case Token.tLT:
|
||||
case Token.tLTEQUAL:
|
||||
case Token.tGTEQUAL:
|
||||
Token mark = mark();
|
||||
Token t = consume();
|
||||
Token next = LA(1);
|
||||
shiftExpression(expression);
|
||||
try{ callback.expressionOperator(expression, t);} catch( Exception e ) {}
|
||||
if( next == LA(1) )
|
||||
{
|
||||
// we did not consume anything
|
||||
// this is most likely an error
|
||||
backup( mark );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
try{ callback.expressionOperator(expression, t);} catch( Exception e ) {}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -2195,6 +2233,21 @@ c, quick);
|
|||
castExpression( expression );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param expression
|
||||
* @throws Backtrack
|
||||
*
|
||||
*
|
||||
* newexpression: ::? new newplacement? newtypeid newinitializer?
|
||||
* ::? new newplacement? ( typeid ) newinitializer?
|
||||
* newplacement: ( expressionlist )
|
||||
* newtypeid: typespecifierseq newdeclarator?
|
||||
* newdeclarator: ptroperator newdeclarator? | directnewdeclarator
|
||||
* directnewdeclarator: [ expression ]
|
||||
* directnewdeclarator [ constantexpression ]
|
||||
* newinitializer: ( expressionlist? )
|
||||
*/
|
||||
protected void newExpression( Object expression ) throws Backtrack {
|
||||
if (LT(1) == Token.tCOLONCOLON) {
|
||||
// global scope
|
||||
|
@ -2203,7 +2256,34 @@ c, quick);
|
|||
|
||||
consume (Token.t_new);
|
||||
|
||||
//TODO: finish this horrible mess...
|
||||
// TODO: We are still not handling placement new right
|
||||
// there are some ambiguities here that make it difficult to look ahead on
|
||||
// we will need a better strategy in order to not do 3 or 4 backtracks
|
||||
// every new expression
|
||||
|
||||
boolean typeIdInBrackets = false;
|
||||
if( LT(1) == Token.tLPAREN )
|
||||
{
|
||||
consume( Token.tLPAREN );
|
||||
typeIdInBrackets = true;
|
||||
}
|
||||
|
||||
typeId();
|
||||
|
||||
if( typeIdInBrackets )
|
||||
{
|
||||
consume( Token.tRPAREN );
|
||||
}
|
||||
|
||||
// newinitializer
|
||||
if( LT(1) == Token.tLPAREN )
|
||||
{
|
||||
consume( Token.tLPAREN );
|
||||
if( LT(1) != Token.tRPAREN )
|
||||
assignmentExpression( expression );
|
||||
consume( Token.tRPAREN );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void unaryExpression( Object expression ) throws Backtrack {
|
||||
|
@ -2476,7 +2556,9 @@ c, quick);
|
|||
if (currToken == null)
|
||||
currToken = fetchToken();
|
||||
|
||||
lastToken = currToken;
|
||||
if( currToken != null )
|
||||
lastToken = currToken;
|
||||
|
||||
currToken = currToken.getNext();
|
||||
return lastToken;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2003-04-27 John Camelon
|
||||
Added testBug36932() to DOMTests.
|
||||
Moved testBugFunctor758() from LokiFailures to DOMTests.
|
||||
Moved testBug36704() from DOMFailedTest to DOMTests.
|
||||
Moved testBug36699() from DOMFailedTest to DOMTests.
|
||||
Moved testBug36691() from DOMFailedTest to DOMTests.
|
||||
|
||||
2003-04-25 Andrew Niefer
|
||||
Moved ACEFailedTest::testBug36771 to DOMTests
|
||||
Moved DOMFailedTest::testBug36714 to DOMTests
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.failedTests;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.eclipse.cdt.core.parser.tests.BaseDOMTest;
|
||||
|
||||
/**
|
||||
|
@ -23,33 +20,6 @@ public class DOMFailedTest extends BaseDOMTest {
|
|||
public DOMFailedTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testBug36704() throws Exception {
|
||||
failTest("template <class T, class U> struct Length< Typelist<T, U> > { enum { value = 1 + Length<U>::value };};);");
|
||||
}
|
||||
|
||||
public void testBug36691() throws Exception {
|
||||
Writer code = new StringWriter();
|
||||
code.write("template <class T, class H>\n");
|
||||
code.write(
|
||||
"typename H::template Rebind<T>::Result& Field(H& obj)\n");
|
||||
code.write("{ return obj; }\n");
|
||||
failTest(code.toString());
|
||||
}
|
||||
|
||||
public void testBug36699() throws Exception {
|
||||
Writer code = new StringWriter();
|
||||
code.write(
|
||||
"template < template <class> class ThreadingModel = DEFAULT_THREADING,\n");
|
||||
code.write("std::size_t chunkSize = DEFAULT_CHUNK_SIZE,\n");
|
||||
code.write(
|
||||
"std::size_t maxSmallObjectSize = MAX_SMALL_OBJECT_SIZE >\n");
|
||||
code.write("class SmallObject : public ThreadingModel<\n");
|
||||
code.write(
|
||||
"SmallObject<ThreadingModel, chunkSize, maxSmallObjectSize> >\n");
|
||||
code.write("{};\n");
|
||||
failTest(code.toString());
|
||||
}
|
||||
|
||||
public void testBug36730(){
|
||||
failTest("FUNCTION_MACRO( 1, a );\n int i;");
|
||||
|
|
|
@ -28,10 +28,6 @@ public class LokiFailures extends BaseDOMTest {
|
|||
public void testBugSingleton192() {
|
||||
failTest("int Test::* pMember_;" );
|
||||
}
|
||||
|
||||
public void testBugFunctor758() {
|
||||
failTest( "template <typename Fun> Functor(Fun fun) : spImpl_(new FunctorHandler<Functor, Fun>(fun)){}" );
|
||||
}
|
||||
|
||||
public void testBugTypeManip151()
|
||||
{
|
||||
|
|
|
@ -1712,5 +1712,48 @@ public class DOMTests extends BaseDOMTest {
|
|||
|
||||
TranslationUnit tu = parse( code.toString() );
|
||||
}
|
||||
|
||||
public void testBugFunctor758() throws Exception {
|
||||
TranslationUnit tu = parse( "template <typename Fun> Functor(Fun fun) : spImpl_(new FunctorHandler<Functor, Fun>(fun)){}" );
|
||||
}
|
||||
|
||||
public void testBug36932() throws Exception
|
||||
{
|
||||
TranslationUnit tu = parse( "A::A(): b( new int( 5 ) ), b( new B ), c( new int ) {}" );
|
||||
}
|
||||
|
||||
public void testBug36704() throws Exception {
|
||||
Writer code = new StringWriter();
|
||||
code.write( "template <class T, class U>\n" );
|
||||
code.write( "struct Length< Typelist<T, U> >\n" );
|
||||
code.write( "{\n" );
|
||||
code.write( "enum { value = 1 + Length<U>::value };\n" );
|
||||
code.write( "};\n" );
|
||||
parse(code.toString());
|
||||
}
|
||||
|
||||
public void testBug36699() throws Exception {
|
||||
Writer code = new StringWriter();
|
||||
code.write(
|
||||
"template < template <class> class ThreadingModel = DEFAULT_THREADING,\n");
|
||||
code.write("std::size_t chunkSize = DEFAULT_CHUNK_SIZE,\n");
|
||||
code.write(
|
||||
"std::size_t maxSmallObjectSize = MAX_SMALL_OBJECT_SIZE >\n");
|
||||
code.write("class SmallObject : public ThreadingModel<\n");
|
||||
code.write(
|
||||
"SmallObject<ThreadingModel, chunkSize, maxSmallObjectSize> >\n");
|
||||
code.write("{};\n");
|
||||
parse(code.toString());
|
||||
}
|
||||
|
||||
public void testBug36691() throws Exception {
|
||||
Writer code = new StringWriter();
|
||||
code.write("template <class T, class H>\n");
|
||||
code.write(
|
||||
"typename H::template Rebind<T>::Result& Field(H& obj)\n");
|
||||
code.write("{ return obj; }\n");
|
||||
parse(code.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue