mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
CORE
Fixed Bug 43106 : Symbol Table support needed to resolve types Fixed Bug 43375 : isExtern not returning true for extern declarations TESTS Added testBug43375() to CompleteParseASTTest. Moved testConditionalExpressionWithReferencesB_Bug43106 from failed tests to passed tests. Moved testPMDotStar() and testPMArrowStar to failed tests w/defect number 43579.
This commit is contained in:
parent
18908c982d
commit
a317cc46f9
11 changed files with 95 additions and 55 deletions
|
@ -1,3 +1,8 @@
|
|||
2003-09-24 John Camelon
|
||||
Added testBug43375() to CompleteParseASTTest.
|
||||
Moved testConditionalExpressionWithReferencesB_Bug43106 from failed tests to passed tests.
|
||||
Moved testPMDotStar() and testPMArrowStar to failed tests w/defect number 43579.
|
||||
|
||||
2003-09-23 John Camelon
|
||||
Replaced ASTFailedTests::testBug39504A() with CompleteParseASTTest::testBug39504().
|
||||
Moved testPostfixTypeIdExpression2() && testPostfixTypeIdTypeId2() to CompleteParseASTExpressionTest.
|
||||
|
|
|
@ -40,21 +40,6 @@ public class FailedCompleteParseASTExpressionTest extends CompleteParseBaseTest
|
|||
{
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testConditionalExpressionWithReferencesB_Bug43106() throws Exception {
|
||||
Iterator i = parse( "class A{}; class B : public A{}; int foo(); int foo(A&); A a ; B b; int c = 0; int x = foo( c > 5 ? b : a );").getDeclarations();
|
||||
IASTClassSpecifier cla = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTClassSpecifier clb = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTFunction foo1 = (IASTFunction)i.next();
|
||||
IASTFunction foo2 = (IASTFunction)i.next();
|
||||
IASTVariable a = (IASTVariable)i.next();
|
||||
IASTVariable b = (IASTVariable)i.next();
|
||||
IASTVariable c = (IASTVariable)i.next();
|
||||
IASTVariable x = (IASTVariable)i.next();
|
||||
assertFalse( i.hasNext() );
|
||||
assertAllReferences( 7 /* should be 8 */,
|
||||
createTaskList( new Task( cla, 3 ), new Task( clb ), new Task( c), new Task( b ), new Task( a )/*, new Task( foo2) */));
|
||||
}
|
||||
|
||||
public void testPMDotStarPointerToMemberFunction_Bug43242() throws Exception
|
||||
{
|
||||
|
@ -98,7 +83,36 @@ public class FailedCompleteParseASTExpressionTest extends CompleteParseBaseTest
|
|||
IASTVariable x = (IASTVariable) i.next();
|
||||
assertAllReferences( 2 /* should be 3 */,
|
||||
createTaskList( new Task( m ), new Task( pm ) /* ,new Task( f2 )*/));
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Kind DELETE_CASTEXPRESSION
|
||||
// Kind DELETE_VECTORCASTEXPRESSION
|
||||
// Kind CASTEXPRESSION
|
||||
// Kind PM_DOTSTAR
|
||||
public void testPMDotStar_bug43579() throws Exception
|
||||
{
|
||||
Iterator i = parse ("class A { int m; }; \n A a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a.*pm);").getDeclarations();
|
||||
IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTVariable a = (IASTVariable) i.next();
|
||||
IASTVariable pm = (IASTVariable) i.next();
|
||||
IASTFunction f1 = (IASTFunction) i.next();
|
||||
IASTFunction f2 = (IASTFunction) i.next();
|
||||
IASTVariable x = (IASTVariable) i.next();
|
||||
assertFalse( i.hasNext() );
|
||||
assertAllReferences( 4 /*should be 5 */, createTaskList( new Task( cl /* , 2 */ ), new Task( a), new Task( pm), new Task( f2)));
|
||||
}
|
||||
|
||||
// Kind PM_ARROWSTAR
|
||||
public void testPMArrowStar_bug43579() throws Exception
|
||||
{
|
||||
Iterator i = parse ("class A { int m; }; \n A * a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a->*pm);").getDeclarations();
|
||||
IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTVariable a = (IASTVariable) i.next();
|
||||
IASTVariable pm = (IASTVariable) i.next();
|
||||
IASTFunction f1 = (IASTFunction) i.next();
|
||||
IASTFunction f2 = (IASTFunction) i.next();
|
||||
IASTVariable x = (IASTVariable) i.next();
|
||||
assertFalse( i.hasNext() );
|
||||
assertAllReferences( 4 /*should be 5 */, createTaskList( new Task( cl /* , 2 */ ), new Task( a), new Task( pm), new Task( f2)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,10 +50,6 @@ public class CompleteParseASTExpressionTest extends CompleteParseBaseTest{
|
|||
IASTFunction f2 = (IASTFunction) i.next();
|
||||
IASTVariable x = (IASTVariable) i.next();
|
||||
assertAllReferences( 1, createTaskList( new Task( f1 )));
|
||||
// Iterator references = callback.getReferences().iterator();
|
||||
// IASTFunctionReference fr1 = (IASTFunctionReference) references.next();
|
||||
// assertEquals( fr1.getReferencedElement(), f1 );
|
||||
|
||||
}
|
||||
// Kind PRIMARY_CHAR_LITERAL : char
|
||||
public void testPrimaryCharLiteral() throws Exception
|
||||
|
@ -471,35 +467,6 @@ public class CompleteParseASTExpressionTest extends CompleteParseBaseTest{
|
|||
// assertFalse( i.hasNext() );
|
||||
// assertAllReferences( 3, createTaskList( new Task( cl, 2), new Task( foo2 )));
|
||||
// }
|
||||
|
||||
// Kind DELETE_CASTEXPRESSION
|
||||
// Kind DELETE_VECTORCASTEXPRESSION
|
||||
// Kind CASTEXPRESSION
|
||||
// Kind PM_DOTSTAR
|
||||
public void testPMDotStar() throws Exception
|
||||
{
|
||||
Iterator i = parse ("class A { int m; }; \n A a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a.*pm);").getDeclarations();
|
||||
IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTVariable a = (IASTVariable) i.next();
|
||||
IASTVariable pm = (IASTVariable) i.next();
|
||||
IASTFunction f1 = (IASTFunction) i.next();
|
||||
IASTFunction f2 = (IASTFunction) i.next();
|
||||
IASTVariable x = (IASTVariable) i.next();
|
||||
assertAllReferences( 4, createTaskList( new Task( cl ), new Task( a), new Task( pm ), new Task(f2)));
|
||||
}
|
||||
|
||||
// Kind PM_ARROWSTAR
|
||||
public void testPMArrowStar() throws Exception
|
||||
{
|
||||
Iterator i = parse ("class A { int m; }; \n A * a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a->*pm);").getDeclarations();
|
||||
IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTVariable a = (IASTVariable) i.next();
|
||||
IASTVariable pm = (IASTVariable) i.next();
|
||||
IASTFunction f1 = (IASTFunction) i.next();
|
||||
IASTFunction f2 = (IASTFunction) i.next();
|
||||
IASTVariable x = (IASTVariable) i.next();
|
||||
assertAllReferences( 4, createTaskList( new Task( cl ), new Task( a), new Task( pm), new Task( f2)));
|
||||
}
|
||||
|
||||
// Kind MULTIPLICATIVE_MULTIPLY : usual arithmetic conversions
|
||||
public void testMultiplicativeMultiply() throws Exception {
|
||||
|
@ -842,4 +809,20 @@ public class CompleteParseASTExpressionTest extends CompleteParseBaseTest{
|
|||
}
|
||||
// Kind EXPRESSIONLIST : list of LHS, RHS
|
||||
// Already tested with each test trying to find a reference to function.
|
||||
|
||||
public void testConditionalExpressionWithReferencesB_Bug43106() throws Exception {
|
||||
Iterator i = parse( "class A{}; class B : public A{}; int foo(); int foo(A&); A a ; B b; int c = 0; int x = foo( c > 5 ? b : a );").getDeclarations();
|
||||
IASTClassSpecifier cla = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTClassSpecifier clb = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTFunction foo1 = (IASTFunction)i.next();
|
||||
IASTFunction foo2 = (IASTFunction)i.next();
|
||||
IASTVariable a = (IASTVariable)i.next();
|
||||
IASTVariable b = (IASTVariable)i.next();
|
||||
IASTVariable c = (IASTVariable)i.next();
|
||||
IASTVariable x = (IASTVariable)i.next();
|
||||
assertFalse( i.hasNext() );
|
||||
assertAllReferences( 8,
|
||||
createTaskList( new Task( cla, 3 ), new Task( clb ), new Task( c), new Task( b ), new Task( a ), new Task( foo2) ));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -806,4 +806,10 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
|||
assertEquals( callback.getReferences().size(), 2 );
|
||||
}
|
||||
|
||||
public void testBug43375() throws Exception
|
||||
{
|
||||
IASTVariable varX = (IASTVariable)parse( "extern int x;").getDeclarations().next();
|
||||
assertTrue( varX.isExtern() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2003-09-24 John Camelon
|
||||
Fixed Bug 43106 : Symbol Table support needed to resolve types
|
||||
Fixed Bug 43375 : isExtern not returning true for extern declarations
|
||||
|
||||
2003-09-23 John Camelon
|
||||
Fixed Bug 43084 : need to restructure TypeId to allow dynamic_cast<> type expression references.
|
||||
Fixed Bug 39504 : sizeof-expressions are not handled properly
|
||||
|
|
|
@ -102,6 +102,4 @@ public interface ISourceElementRequestor {
|
|||
public void exitNamespaceDefinition( IASTNamespaceDefinition namespaceDefinition );
|
||||
public void exitInclusion( IASTInclusion inclusion );
|
||||
public void exitCompilationUnit( IASTCompilationUnit compilationUnit );
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -202,7 +202,11 @@ public interface IASTFactory
|
|||
public IASTCodeScope createNewCodeBlock(IASTScope scope);
|
||||
|
||||
public IASTTypeId createTypeId( IASTScope scope, IASTSimpleTypeSpecifier.Type kind, boolean isConst, boolean isVolatile, boolean isShort,
|
||||
boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods ) throws ASTSemanticException;
|
||||
boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods ) throws ASTSemanticException;
|
||||
/**
|
||||
* @param astClassSpecifier
|
||||
*/
|
||||
public void signalEndOfClassSpecifier(IASTClassSpecifier astClassSpecifier);
|
||||
|
||||
|
||||
}
|
|
@ -15,7 +15,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
|
|
|
@ -2508,7 +2508,11 @@ public class Parser implements IParser
|
|||
// consume the }
|
||||
IToken lt = consume(IToken.tRBRACE);
|
||||
astClassSpecifier.setEndingOffset(lt.getEndOffset());
|
||||
|
||||
astFactory.signalEndOfClassSpecifier( astClassSpecifier );
|
||||
|
||||
astClassSpecifier.exitScope( requestor );
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -1978,7 +1978,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
{
|
||||
newSymbol.getTypeInfo().setBit( isMutable, TypeInfo.isMutable );
|
||||
newSymbol.getTypeInfo().setBit( isAuto, TypeInfo.isAuto );
|
||||
newSymbol.getTypeInfo().setBit( isExtern, TypeInfo.isExplicit );
|
||||
newSymbol.getTypeInfo().setBit( isExtern, TypeInfo.isExtern );
|
||||
newSymbol.getTypeInfo().setBit( isRegister, TypeInfo.isRegister );
|
||||
newSymbol.getTypeInfo().setBit( isStatic, TypeInfo.isStatic );
|
||||
newSymbol.getTypeInfo().setBit( abstractDeclaration.isConst(), TypeInfo.isConst );
|
||||
|
@ -2438,4 +2438,20 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
setPointerOperators( result, id.getPointerOperators(), id.getArrayModifiers() );
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#signalEndOfClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
|
||||
*/
|
||||
public void signalEndOfClassSpecifier(IASTClassSpecifier astClassSpecifier)
|
||||
{
|
||||
if( astClassSpecifier == null ) return;
|
||||
try
|
||||
{
|
||||
((IDerivableContainerSymbol)((ASTClassSpecifier)astClassSpecifier).getSymbol()).addCopyConstructor();
|
||||
}
|
||||
catch (ParserSymbolTableException e)
|
||||
{
|
||||
// do nothing, this is best effort
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -307,4 +307,11 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
return new ASTTypeId( kind, name == null ? "" : name.toString(), pointerOps, arrayMods, isConst,
|
||||
isVolatile, isUnsigned, isSigned, isShort, isLong, isTypename );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#signalEndOfClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
|
||||
*/
|
||||
public void signalEndOfClassSpecifier(IASTClassSpecifier astClassSpecifier)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue