Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Applied [HEAD] Additional FullParse bugfixes

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. 

JohnC

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.110
diff -u -r1.110 ChangeLog
--- ChangeLog	24 Sep 2003 14:20:44 -0000	1.110
+++ ChangeLog	24 Sep 2003 15:00:15 -0000
@@ -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. 
Index: failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java,v
retrieving revision 1.6
diff -u -r1.6 FailedCompleteParseASTExpressionTest.java
--- failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java	23 Sep 2003 22:58:26 -0000	1.6
+++ failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java	24 Sep 2003 15:00:15 -0000
@@ -40,21 +40,6 @@
     {
         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 @@
 		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)));
 	}
-	    
 }
Index: parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java,v
retrieving revision 1.7
diff -u -r1.7 CompleteParseASTExpressionTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java	23 Sep 2003 22:58:26 -0000	1.7
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java	24 Sep 2003 15:00:16 -0000
@@ -50,10 +50,6 @@
 		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 @@
 //		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 @@
 	}
 	// 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) ));
+	}
+
 }
Index: parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java,v
retrieving revision 1.32
diff -u -r1.32 CompleteParseASTTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java	23 Sep 2003 22:58:26 -0000	1.32
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java	24 Sep 2003 15:00:17 -0000
@@ -806,4 +806,10 @@
 		assertEquals( callback.getReferences().size(), 2 );
 	}
 	
+	public void testBug43375() throws Exception
+	{
+		IASTVariable varX = (IASTVariable)parse( "extern int x;").getDeclarations().next();
+		assertTrue( varX.isExtern() ); 	
+	}
+	
 }
Index: parser/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/ChangeLog,v
retrieving revision 1.135
diff -u -r1.135 ChangeLog
--- parser/ChangeLog	23 Sep 2003 22:58:34 -0000	1.135
+++ parser/ChangeLog	24 Sep 2003 14:59:52 -0000
@@ -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 
Index: parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java,v
retrieving revision 1.14
diff -u -r1.14 ISourceElementRequestor.java
--- parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java	15 Sep 2003 22:50:25 -0000	1.14
+++ parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java	24 Sep 2003 14:59:52 -0000
@@ -102,6 +102,4 @@
 	public void exitNamespaceDefinition( IASTNamespaceDefinition namespaceDefinition ); 
 	public void exitInclusion( IASTInclusion inclusion ); 
 	public void exitCompilationUnit( IASTCompilationUnit compilationUnit );
-
-   
 }
Index: parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java,v
retrieving revision 1.34
diff -u -r1.34 IASTFactory.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java	23 Sep 2003 22:58:34 -0000	1.34
+++ parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java	24 Sep 2003 14:59:53 -0000
@@ -202,7 +202,11 @@
 	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); 
 						
 
 }
Index: parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java,v
retrieving revision 1.21
diff -u -r1.21 DeclarationWrapper.java
--- parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java	23 Sep 2003 22:58:34 -0000	1.21
+++ parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java	24 Sep 2003 14:59:53 -0000
@@ -15,7 +15,6 @@
 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;
Index: parser/org/eclipse/cdt/internal/core/parser/Parser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java,v
retrieving revision 1.112
diff -u -r1.112 Parser.java
--- parser/org/eclipse/cdt/internal/core/parser/Parser.java	23 Sep 2003 22:58:34 -0000	1.112
+++ parser/org/eclipse/cdt/internal/core/parser/Parser.java	24 Sep 2003 14:59:55 -0000
@@ -2508,7 +2508,11 @@
             // consume the }
             IToken lt = consume(IToken.tRBRACE);
             astClassSpecifier.setEndingOffset(lt.getEndOffset());
+            
+            astFactory.signalEndOfClassSpecifier( astClassSpecifier );
+            
             astClassSpecifier.exitScope( requestor );
+            
         }
     }
     /**
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java,v
retrieving revision 1.45
diff -u -r1.45 CompleteParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	23 Sep 2003 22:58:34 -0000	1.45
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	24 Sep 2003 14:59:56 -0000
@@ -1978,7 +1978,7 @@
     {
         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 @@
 		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
+        }
+    }
 }
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java,v
retrieving revision 1.36
diff -u -r1.36 QuickParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java	23 Sep 2003 22:58:34 -0000	1.36
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java	24 Sep 2003 14:59:57 -0000
@@ -307,4 +307,11 @@
         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)
+    {
+    }
 }

Back to the top