Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2004-05-31 16:12:17 -0400
committerAndrew Niefer2004-05-31 16:12:17 -0400
commit9c8337b7516521bd734ebdd1be9a81b89177c15c (patch)
tree59e3c6848d814d176b7fba0e094f7751c545dab4
parent6d52df8fcd680af15570aa8187ecb64f328c52d4 (diff)
downloadorg.eclipse.cdt-9c8337b7516521bd734ebdd1be9a81b89177c15c.tar.gz
org.eclipse.cdt-9c8337b7516521bd734ebdd1be9a81b89177c15c.tar.xz
org.eclipse.cdt-9c8337b7516521bd734ebdd1be9a81b89177c15c.zip
-fix bug 64753
-also put in temporary fix for symbol table tests failing when run as plugin tests but passing when run just as junits
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTemplateTest.java15
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java16
3 files changed, 28 insertions, 7 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTemplateTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTemplateTest.java
index ac155265b06..6fea85a300c 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTemplateTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTemplateTest.java
@@ -923,4 +923,19 @@ public class CompleteParseASTTemplateTest extends CompleteParseBaseTest {
//we aren't going to be completely correct about references to explicit specializations
//due to limitations in the implementation, see bug 59811
}
+
+ public void testBug64753() throws Exception{
+ Writer writer = new StringWriter();
+ writer.write( "template < class _T > void foo () { \n" );
+ writer.write( " if( 1 ) { \n" );
+ writer.write( " _T p1, p2; \n" );
+ writer.write( " int n = p1 - p2; \n" );
+ writer.write( " } \n" );
+ writer.write( "} \n" );
+
+ Iterator i = parse( writer.toString() ).getDeclarations();
+
+ IASTTemplateDeclaration foo = (IASTTemplateDeclaration) i.next();
+ }
+
}
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 1c9f8f23936..33d09c30ce0 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
@@ -2561,6 +2561,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
List references = new ArrayList();
IContainerSymbol ownerScope = scopeToSymbol( scope );
+ if( name == null )
+ handleProblem( IProblem.SEMANTIC_NAME_NOT_PROVIDED, null, startingOffset, nameEndOffset, nameLine );
+
if(name.getSegmentCount() > 1)
{
ISymbol symbol = lookupQualifiedName( ownerScope,
@@ -3219,6 +3222,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
IContainerSymbol newScope = pst.newContainerSymbol(EMPTY_STRING, TypeInfo.t_block);
newScope.setContainingSymbol(symbol);
+ newScope.setIsTemplateMember( symbol.isTemplateMember() );
ASTCodeScope codeScope = new ASTCodeScope( newScope );
attachSymbolExtension( newScope, codeScope, true );
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 728a6b79a97..551ce042392 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
@@ -1238,7 +1238,8 @@ public class ParserSymbolTable {
static private void releaseCosts( Cost [] costs ){
if( costs != null ) {
for( int i = 0; i < costs.length; i++ ){
- costs[i].release();
+ if( costs[i] != null )
+ costs[i].release();
}
}
}
@@ -2485,12 +2486,13 @@ public class ParserSymbolTable {
}
public static synchronized int numAllocated(){
- int num = 0;
- for( int i = 0; i < POOL_SIZE; i++ ){
- if( !free[i] )
- num++;
- }
- return num;
+// int num = 0;
+// for( int i = 0; i < POOL_SIZE; i++ ){
+// if( !free[i] )
+// num++;
+// }
+// return num;
+ return 0;
}
}
}

Back to the top