Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] fix bug 47624

CompleteParseASTFactory should use the symbol table's elaboratedLookup 
instead of qualifiedLookup when it encounters an elaborated type 
specifier.

Core:
change createElaboratedTypeSpecifier to call 
IContainerSymbol.elaboratedLookup

Core.tests
add CompleteParseASTTest.testBug47624

-Andrew

Index: parser/ChangeLog
===================================================================
retrieving revision 1.163
diff -u -r1.163 ChangeLog
--- parser/ChangeLog	20 Nov 2003 15:22:56 -0000	1.163
+++ parser/ChangeLog	27 Nov 2003 22:07:34 -0000
@@ -1,3 +1,6 @@
+2003-11-27 Andrew Niefer
+	fix bug 47264: Parse fails when using  struct s foo; and int s; in function bodies
+
 2003-11-18 Andrew Niefer
 	Refactor PST: Split Declaration into 4 classes : ContainerSymbol, DerivableContainerSymbol, ParameterizedContainerSymbol,
 	SpecializedSymbol.  Move these along with BasicSymbol & TemplateInstance to no longer be nested in ParserSymbolTable.
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
===================================================================
retrieving revision 1.57
diff -u -r1.57 CompleteParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	13 Nov 2003 19:27:10 -0000	1.57
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	27 Nov 2003 22:07:38 -0000
@@ -2484,7 +2484,7 @@
 		ISymbol checkSymbol = null;
 		try
 		{
-			checkSymbol = currentScopeSymbol.qualifiedLookup(lastToken.getImage());
+			checkSymbol = currentScopeSymbol.elaboratedLookup( pstType, lastToken.getImage());
 		}
 		catch (ParserSymbolTableException e)
 		{
Index: ChangeLog
===================================================================
retrieving revision 1.144
diff -u -r1.144 ChangeLog
--- ChangeLog	20 Nov 2003 15:23:01 -0000	1.144
+++ ChangeLog	27 Nov 2003 22:07:14 -0000
@@ -1,3 +1,6 @@
+2003-11-27 Andrew Niefer
+	add CompleteParseASTTest.testBug47624()
+
 2003-11-18 Andrew Niefer
 	update ParserSymbolTableTest to reflect refactoring of Declaration into 4 separate classes.
 
Index: parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
===================================================================
retrieving revision 1.42
diff -u -r1.42 CompleteParseASTTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java	13 Nov 2003 19:27:29 -0000	1.42
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java	27 Nov 2003 22:07:16 -0000
@@ -1055,4 +1055,23 @@
 		assertFalse(i.hasNext());
 	}
 
+	public void testBug47624() throws Exception
+	{
+		StringBuffer buffer = new StringBuffer();
+		buffer.append( "struct s { }; \n" );
+		buffer.append( "void f ( int s ) { \n" );
+		buffer.append( "   struct s sInstance; \n" );
+		buffer.append( "}\n");
+		
+		Iterator i = parse( buffer.toString() ).getDeclarations();
+		IASTClassSpecifier structS = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		IASTFunction function = (IASTFunction) i.next();
+		Iterator fnIter = getDeclarations( function );
+		IASTVariable sInstance = (IASTVariable) fnIter.next();
+		IASTElaboratedTypeSpecifier elaborated = (IASTElaboratedTypeSpecifier) sInstance.getAbstractDeclaration().getTypeSpecifier();
+		assertFalse( fnIter.hasNext() );
+		
+		assertAllReferences( 1, createTaskList( new Task( structS ) ) );
+		assertFalse( i.hasNext() );
+	}
 }

Back to the top