mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
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
This commit is contained in:
parent
4d9be4fde4
commit
1a068f661e
9 changed files with 114 additions and 2 deletions
|
@ -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
|
2003-10-24 John Camelon
|
||||||
Added testBug45476() to ScannerTestCase.
|
Added testBug45476() to ScannerTestCase.
|
||||||
Added testBug45477() to ScannerTestCase.
|
Added testBug45477() to ScannerTestCase.
|
||||||
|
|
|
@ -970,5 +970,45 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
||||||
IASTVariable variable = (IASTVariable)parse( "_Bool x;", true, ParserLanguage.C ).getDeclarations().next();
|
IASTVariable variable = (IASTVariable)parse( "_Bool x;", true, ParserLanguage.C ).getDeclarations().next();
|
||||||
assertEquals( ((IASTSimpleTypeSpecifier)variable.getAbstractDeclaration().getTypeSpecifier()).getType(), IASTSimpleTypeSpecifier.Type._BOOL );
|
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 ) ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
2003-10-24 John Camelon
|
||||||
Fixed Bug 45476 : preprocessor macro "defined" not handled correctly
|
Fixed Bug 45476 : preprocessor macro "defined" not handled correctly
|
||||||
Fixed Bug 45477 : macro redefines prevent further parsing
|
Fixed Bug 45477 : macro redefines prevent further parsing
|
||||||
|
|
|
@ -562,6 +562,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
pstType = TypeInfo.t_struct;
|
pstType = TypeInfo.t_struct;
|
||||||
else if( kind == ASTClassKind.UNION )
|
else if( kind == ASTClassKind.UNION )
|
||||||
pstType = TypeInfo.t_union;
|
pstType = TypeInfo.t_union;
|
||||||
|
else if( kind == ASTClassKind.ENUM )
|
||||||
|
pstType = TypeInfo.t_enumeration;
|
||||||
else
|
else
|
||||||
throw new ASTSemanticException();
|
throw new ASTSemanticException();
|
||||||
return pstType;
|
return pstType;
|
||||||
|
|
|
@ -694,7 +694,18 @@ public class ParserSymbolTable {
|
||||||
return null;
|
return null;
|
||||||
} else if ( numFns == 1 ){
|
} else if ( numFns == 1 ){
|
||||||
return (IParameterizedSymbol)functions.iterator().next();
|
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 );
|
throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -726,6 +737,15 @@ public class ParserSymbolTable {
|
||||||
for( int i = numFns; i > 0; i-- ){
|
for( int i = numFns; i > 0; i-- ){
|
||||||
currFn = (IParameterizedSymbol) iterFns.next();
|
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();
|
sourceParams = data.parameters.iterator();
|
||||||
|
|
||||||
List parameterList = null;
|
List parameterList = null;
|
||||||
|
|
|
@ -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
|
2003-10-22 Hoda Amer
|
||||||
Fixed bug#45115: New Class Wizard: Error in base class doesn't clear when ...
|
Fixed bug#45115: New Class Wizard: Error in base class doesn't clear when ...
|
||||||
|
|
||||||
|
|
|
@ -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.FIELD, ICSearchConstants.DECLARATIONS, true ));
|
||||||
orPattern.addPattern(SearchEngine.createSearchPattern( sel, ICSearchConstants.NAMESPACE, 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.MACRO, ICSearchConstants.DECLARATIONS, true ));
|
||||||
|
orPattern.addPattern(SearchEngine.createSearchPattern( sel, ICSearchConstants.TYPEDEF, ICSearchConstants.DECLARATIONS, true ));
|
||||||
searchEngine.search(CUIPlugin.getWorkspace(), orPattern, scope, resultCollector, true);
|
searchEngine.search(CUIPlugin.getWorkspace(), orPattern, scope, resultCollector, true);
|
||||||
elementsFound.addAll(resultCollector.getSearchResults());
|
elementsFound.addAll(resultCollector.getSearchResults());
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,8 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
|
||||||
|
|
||||||
for (Iterator iter = searchFor.iterator(); iter.hasNext();) {
|
for (Iterator iter = searchFor.iterator(); iter.hasNext();) {
|
||||||
SearchFor element = (SearchFor) iter.next();
|
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 );
|
set.add( DEFINITIONS );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -559,6 +560,8 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
|
||||||
|
|
||||||
case ICElement.C_NAMESPACE: searchFor.add( NAMESPACE ); break;
|
case ICElement.C_NAMESPACE: searchFor.add( NAMESPACE ); break;
|
||||||
|
|
||||||
|
case ICElement.C_ENUMERATION: searchFor.add( ENUM ); break;
|
||||||
|
|
||||||
default: searchFor.add( UNKNOWN_SEARCH_FOR ); break;
|
default: searchFor.add( UNKNOWN_SEARCH_FOR ); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue