[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Search Bug fixes
|
This is meant for the HEAD, but could be applied to 1.2 if desired.
core:
Fixed Bug 44925 : Search: Elaborated type specifier
Partially Fixed Bug 44510 : C/C++ Search gives wrong results
ui:
Fixed Bug 44337 : Disabling of "definition" not making sense in Search
dialog
Fixed Bug 44947 : Navigate from Outline: Enumeration type not
pre-populated
Fixed Bug 44948 : Navigate via Open Declarations: typedef decl not found
-Andrew
Index: parser/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/ChangeLog,v
retrieving revision 1.154
diff -u -r1.154 ChangeLog
--- parser/ChangeLog 24 Oct 2003 21:34:11 -0000 1.154
+++ parser/ChangeLog 28 Oct 2003 20:02:43 -0000
@@ -1,3 +1,7 @@
+2003-10-28 Andrew Niefer
+ Fixed Bug 44925 : Search: Elaborated type specifier
+ Patially fixed Bug 44510 : C/C++ Search gives wrong results
+
2003-10-24 John Camelon
Fixed Bug 45476 : preprocessor macro "defined" not handled correctly
Fixed Bug 45477 : macro redefines prevent further parsing
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.54
diff -u -r1.54 CompleteParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java 24 Oct 2003 17:49:16 -0000 1.54
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java 28 Oct 2003 20:02:44 -0000
@@ -562,6 +562,8 @@
pstType = TypeInfo.t_struct;
else if( kind == ASTClassKind.UNION )
pstType = TypeInfo.t_union;
+ else if( kind == ASTClassKind.ENUM )
+ pstType = TypeInfo.t_enumeration;
else
throw new ASTSemanticException();
return pstType;
Index: parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java,v
retrieving revision 1.24
diff -u -r1.24 ParserSymbolTable.java
--- parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java 1 Oct 2003 21:15:40 -0000 1.24
+++ parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java 28 Oct 2003 20:02:45 -0000
@@ -694,7 +694,18 @@
return null;
} else if ( numFns == 1 ){
return (IParameterizedSymbol)functions.iterator().next();
- } else{
+ } else if ( numFns == 2 ){
+ Iterator iter = functions.iterator();
+ while( iter.hasNext() ){
+ IParameterizedSymbol fn = (IParameterizedSymbol) iter.next();
+ if( fn.getTypeInfo().isForwardDeclaration() && fn.getTypeSymbol() != null ){
+ if( functions.contains( fn.getTypeSymbol() ) ){
+ return (IParameterizedSymbol) fn.getTypeSymbol();
+ }
+ }
+ }
+ throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
+ }else{
throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
}
}
@@ -725,6 +736,11 @@
for( int i = numFns; i > 0; i-- ){
currFn = (IParameterizedSymbol) iterFns.next();
+
+ if( bestFn != null && bestFn.isForwardDeclaration() && bestFn.getTypeSymbol() == currFn ){
+ bestFn = currFn;
+ continue;
+ }
sourceParams = data.parameters.iterator();
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.136
diff -u -r1.136 ChangeLog
--- ChangeLog 24 Oct 2003 21:34:15 -0000 1.136
+++ ChangeLog 28 Oct 2003 20:02:58 -0000
@@ -1,3 +1,8 @@
+2003-10-28 Andrew Niefer
+ Added testBug44510() to CompleteParseASTTest
+ Added testBug44925() to CompleteParseASTTest
+ Added testBug44510() to ParserSymbolTableTest
+
2003-10-24 John Camelon
Added testBug45476() to ScannerTestCase.
Added testBug45477() to ScannerTestCase.
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.39
diff -u -r1.39 CompleteParseASTTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java 24 Oct 2003 17:49:22 -0000 1.39
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java 28 Oct 2003 20:02:58 -0000
@@ -970,5 +970,39 @@
IASTVariable variable = (IASTVariable)parse( "_Bool x;", true, ParserLanguage.C ).getDeclarations().next();
assertEquals( ((IASTSimpleTypeSpecifier)variable.getAbstractDeclaration().getTypeSpecifier()).getType(), IASTSimpleTypeSpecifier.Type._BOOL );
}
+
+ public void testBug44510() throws Exception
+ {
+ Iterator i = parse( "int initialize(); int initialize(){ return 1; } void main(){ int i = initialize(); }" ).getDeclarations();
+ IASTFunction function1 = (IASTFunction) i.next();
+ assertEquals( function1.previouslyDeclared(), false );
+
+ IASTFunction function2 = (IASTFunction) i.next();
+ assertEquals( function2.previouslyDeclared(), true );
+
+ IASTFunction main = (IASTFunction) i.next();
+ assertFalse( i.hasNext() );
+
+ assertAllReferences( 1, createTaskList( new Task( function2 ) ) );
+ }
+
+ public void testBug44925() throws Exception
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append( "class MyClass { };");
+ buffer.append( "class MyClass myObj1;");
+ buffer.append( "enum MyEnum { Item1 };");
+ buffer.append( "enum MyEnum myObj2;");
+ Iterator i = parse( buffer.toString() ).getDeclarations();
+
+ IASTClassSpecifier MyClass = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+ IASTVariable myObj1 = (IASTVariable) i.next();
+ IASTEnumerationSpecifier MyEnum = (IASTEnumerationSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+ IASTVariable myObj2 = (IASTVariable) i.next();
+
+ assertFalse( i.hasNext() );
+
+ assertAllReferences( 2, createTaskList( new Task( MyClass ), new Task( MyEnum ) ) );
+ }
}
Index: parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java,v
retrieving revision 1.22
diff -u -r1.22 ParserSymbolTableTest.java
--- parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java 30 Sep 2003 18:03:20 -0000 1.22
+++ parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java 28 Oct 2003 20:02:59 -0000
@@ -2912,5 +2912,37 @@
}
}
+
+ /**
+ * int initialize();
+ * int initialize(){
+ * return 3;
+ * }
+ *
+ * int i = initialize();
+ *
+ * @throws Exception
+ */
+ public void testBug44510() throws Exception{
+ newTable();
+
+ IParameterizedSymbol init1 = table.newParameterizedSymbol( "initialize", TypeInfo.t_function );
+
+ table.getCompilationUnit().addSymbol( init1 );
+
+ IParameterizedSymbol init2 = table.newParameterizedSymbol( "initialize", TypeInfo.t_function );
+
+ ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "initialize", new LinkedList() );
+ assertEquals( look, init1 );
+
+ init1.getTypeInfo().setIsForwardDeclaration( true );
+ init1.setTypeSymbol( init2 );
+
+ table.getCompilationUnit().addSymbol( init2 );
+
+ look = table.getCompilationUnit().unqualifiedFunctionLookup( "initialize", new LinkedList() );
+
+ assertEquals( look, init2 );
+ }
}
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.213
diff -u -r1.213 ChangeLog
--- ChangeLog 27 Oct 2003 18:26:46 -0000 1.213
+++ ChangeLog 28 Oct 2003 20:03:12 -0000
@@ -1,3 +1,8 @@
+2003-10-28 Andrew Niefer
+ fix bug 44337 : Disabling of "definition" not making sense in Search dialog
+ fix bug 44947 : Navigate from Outline: Enumeration type not pre-populated
+ fix bug 44948 : Navigate via Open Declarations: typedef decl not found
+
2003-10-22 Hoda Amer
Fixed bug#45115: New Class Wizard: Error in base class doesn't clear when ...
Index: src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java,v
retrieving revision 1.2
diff -u -r1.2 OpenDeclarationsAction.java
--- src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java 22 Sep 2003 18:38:30 -0000 1.2
+++ src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java 28 Oct 2003 20:03:13 -0000
@@ -125,6 +125,7 @@
orPattern.addPattern(SearchEngine.createSearchPattern( sel, ICSearchConstants.FIELD, ICSearchConstants.DECLARATIONS, true ));
orPattern.addPattern(SearchEngine.createSearchPattern( sel, ICSearchConstants.NAMESPACE, ICSearchConstants.DECLARATIONS, true ));
orPattern.addPattern(SearchEngine.createSearchPattern( sel, ICSearchConstants.MACRO, ICSearchConstants.DECLARATIONS, true ));
+ orPattern.addPattern(SearchEngine.createSearchPattern( sel, ICSearchConstants.TYPEDEF, ICSearchConstants.DECLARATIONS, true ));
searchEngine.search(CUIPlugin.getWorkspace(), orPattern, scope, resultCollector, true);
elementsFound.addAll(resultCollector.getSearchResults());
Index: src/org/eclipse/cdt/internal/ui/search/CSearchPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java,v
retrieving revision 1.12
diff -u -r1.12 CSearchPage.java
--- src/org/eclipse/cdt/internal/ui/search/CSearchPage.java 1 Oct 2003 21:33:22 -0000 1.12
+++ src/org/eclipse/cdt/internal/ui/search/CSearchPage.java 28 Oct 2003 20:03:13 -0000
@@ -305,7 +305,8 @@
for (Iterator iter = searchFor.iterator(); iter.hasNext();) {
SearchFor element = (SearchFor) iter.next();
- if( element == FUNCTION || element == METHOD || element == VAR || element == FIELD || element == NAMESPACE ){
+ if( element == FUNCTION || element == METHOD || element == VAR ||
+ element == FIELD || element == NAMESPACE || element == UNKNOWN_SEARCH_FOR ){
set.add( DEFINITIONS );
break;
}
@@ -558,6 +559,8 @@
case ICElement.C_METHOD: searchFor.add( METHOD ); break;
case ICElement.C_NAMESPACE: searchFor.add( NAMESPACE ); break;
+
+ case ICElement.C_ENUMERATION: searchFor.add( ENUM ); break;
default: searchFor.add( UNKNOWN_SEARCH_FOR ); break;
}