Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2003-10-01 17:15:45 -0400
committerJohn Camelon2003-10-01 17:15:45 -0400
commite63b06fc5fb272921fc03697c3b8acb14d3f7283 (patch)
tree760f1371ac7eb6c0c97719e5ac39ba78b5fc6c07
parent9b33f17d3f9e3c295cf830f4d3a26130e318ede0 (diff)
downloadorg.eclipse.cdt-e63b06fc5fb272921fc03697c3b8acb14d3f7283.tar.gz
org.eclipse.cdt-e63b06fc5fb272921fc03697c3b8acb14d3f7283.tar.xz
org.eclipse.cdt-e63b06fc5fb272921fc03697c3b8acb14d3f7283.zip
Patch for Andrew Niefer
core: PST changes: - modify lookupConstructor to copy the constructor list before resolving on it - modify checkUserDefinedConversionSequence the same way - modify isValidFunctionOverload to check for forward declarations core.tests: - added testBug43951 to CompleteParseASTTest
-rw-r--r--core/org.eclipse.cdt.core.tests/ChangeLog3
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java12
-rw-r--r--core/org.eclipse.cdt.core/parser/ChangeLog7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java15
4 files changed, 34 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog
index 18eb7f206a..ec1fcfce71 100644
--- a/core/org.eclipse.cdt.core.tests/ChangeLog
+++ b/core/org.eclipse.cdt.core.tests/ChangeLog
@@ -1,4 +1,7 @@
2003-10-01 Andrew Niefer
+ added testBug43951 to CompleteParseASTTest
+
+2003-10-01 Andrew Niefer
modified OtherPatternTests.testBug42911() and renamed it testBug42911_43988
2003-10-01 Andrew Niefer
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 f29b1c0191..798cac3f90 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
@@ -31,7 +31,6 @@ import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
import org.eclipse.cdt.core.parser.ast.IASTReference;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
@@ -906,4 +905,15 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
fail();
}
}
+
+ public void testBug43951() throws Exception
+ {
+ Iterator i = parse( "class B{ B(); ~B(); }; B::B(){} B::~B(){}", false ).getDeclarations();
+
+ IASTClassSpecifier b = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+ assertEquals( b.getName(), "B");
+ IASTMethod constructor = (IASTMethod) i.next();
+ assertEquals( constructor.getName(), "B" );
+ assertTrue( constructor.previouslyDeclared() );
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/ChangeLog b/core/org.eclipse.cdt.core/parser/ChangeLog
index 24411a308b..326074b112 100644
--- a/core/org.eclipse.cdt.core/parser/ChangeLog
+++ b/core/org.eclipse.cdt.core/parser/ChangeLog
@@ -3,6 +3,13 @@
Fixed Bug 43997 : Search results: selection includes preceding whitespace
Fixed Bug 44034 : Scanner failure on #undef
+2003-10-01 Andrew Niefer
+ bug43951 - search on ctor declarations returns definition too.
+ PST changes:
+ - modify lookupConstructor to copy the constructor list before resolving on it
+ - modify checkUserDefinedConversionSequence the same way
+ - modify isValidFunctionOverload to check for forward declarations
+
2003-10-01 Bogdan Gheorghe
Modified CDT log dump in Parser.fetchToken to include error message
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 869c452318..bedd39d3cf 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
@@ -512,6 +512,12 @@ public class ParserSymbolTable {
return false;
}
+ //handle forward decls
+ if( origSymbol.getTypeInfo().isForwardDeclaration() &&
+ origSymbol.getTypeSymbol() == newSymbol )
+ {
+ return true;
+ }
if( origSymbol.hasSameParameters( newSymbol ) ){
//functions with the same name and same parameter types cannot be overloaded if any of them
//is static
@@ -1473,7 +1479,8 @@ public class ParserSymbolTable {
}
if( container.getConstructors() != null ){
- constructor = resolveFunction( data, container.getConstructors() );
+ LinkedList constructors = new LinkedList( container.getConstructors() );
+ constructor = resolveFunction( data, constructors );
}
if( constructor != null && constructor.getTypeInfo().checkBit( TypeInfo.isExplicit ) ){
constructor = null;
@@ -3294,7 +3301,11 @@ public class ParserSymbolTable {
LookupData data = new LookupData( EMPTY_NAME, TypeInfo.t_constructor, null );
data.parameters = parameters;
- return ParserSymbolTable.resolveFunction( data, getConstructors() );
+ List constructors = new LinkedList();
+ if( getConstructors() != null )
+ constructors.addAll( getConstructors() );
+
+ return ParserSymbolTable.resolveFunction( data, constructors );
}
/**

Back to the top