Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJohn Camelon2003-11-03 14:00:24 +0000
committerJohn Camelon2003-11-03 14:00:24 +0000
commit1a068f661e10186f6e5f4fb117a2b9dcd49b9db9 (patch)
tree9583d7d1e7e1a80a398379c04dd0b6d766bed739 /core
parent4d9be4fde44d7fe6f3b39c42c2c229a265ec82f2 (diff)
downloadorg.eclipse.cdt-1a068f661e10186f6e5f4fb117a2b9dcd49b9db9.tar.gz
org.eclipse.cdt-1a068f661e10186f6e5f4fb117a2b9dcd49b9db9.tar.xz
org.eclipse.cdt-1a068f661e10186f6e5f4fb117a2b9dcd49b9db9.zip
Patch for Andrew Niefer
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
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/ChangeLog5
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java40
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java32
-rw-r--r--core/org.eclipse.cdt.core/parser/ChangeLog4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java22
-rw-r--r--core/org.eclipse.cdt.ui/ChangeLog5
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java1
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java5
9 files changed, 114 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog
index 672ea9d5dab..4cc9bc7e9c6 100644
--- a/core/org.eclipse.cdt.core.tests/ChangeLog
+++ b/core/org.eclipse.cdt.core.tests/ChangeLog
@@ -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.
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
index 9fc9f78a095..cc7641e16d0 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
@@ -970,5 +970,45 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
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( char ){} " +
+ "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(), false );
+
+ IASTFunction function3 = (IASTFunction) i.next();
+ assertEquals( function3.previouslyDeclared(), true );
+ IASTFunction main = (IASTFunction) i.next();
+ assertFalse( i.hasNext() );
+
+ assertAllReferences( 1, createTaskList( new Task( function3 ) ) );
+ }
+
+ 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 ) ) );
+ }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
index 77daec870eb..f5e0783362b 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
@@ -2912,5 +2912,37 @@ public class ParserSymbolTableTest extends TestCase {
}
}
+
+ /**
+ * 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 );
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/ChangeLog b/core/org.eclipse.cdt.core/parser/ChangeLog
index d7b5387bf74..89c450bb86d 100644
--- a/core/org.eclipse.cdt.core/parser/ChangeLog
+++ b/core/org.eclipse.cdt.core/parser/ChangeLog
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
index cd5f01a4451..65ad9da4fcc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
@@ -562,6 +562,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
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;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java
index bedd39d3cfb..02568ae3c64 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java
@@ -694,7 +694,18 @@ public class ParserSymbolTable {
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 );
}
}
@@ -726,6 +737,15 @@ public class ParserSymbolTable {
for( int i = numFns; i > 0; i-- ){
currFn = (IParameterizedSymbol) iterFns.next();
+ if( bestFn != null ){
+ if( bestFn.isForwardDeclaration() && bestFn.getTypeSymbol() == currFn ){
+ bestFn = currFn;
+ continue;
+ } else if( currFn.isForwardDeclaration() && currFn.getTypeSymbol() == bestFn ){
+ continue;
+ }
+ }
+
sourceParams = data.parameters.iterator();
List parameterList = null;
diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog
index 578a67bff6a..ca3aac234be 100644
--- a/core/org.eclipse.cdt.ui/ChangeLog
+++ b/core/org.eclipse.cdt.ui/ChangeLog
@@ -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 ...
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java
index 0349a5344a6..23b86f89221 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java
@@ -125,6 +125,7 @@ public class OpenDeclarationsAction extends Action {
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());
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java
index dc302f910d2..8340503eec7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java
@@ -305,7 +305,8 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
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;
}
@@ -559,6 +560,8 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
case ICElement.C_NAMESPACE: searchFor.add( NAMESPACE ); break;
+ case ICElement.C_ENUMERATION: searchFor.add( ENUM ); break;
+
default: searchFor.add( UNKNOWN_SEARCH_FOR ); break;
}

Back to the top