mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
-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
This commit is contained in:
parent
6d52df8fcd
commit
9c8337b751
3 changed files with 28 additions and 7 deletions
|
@ -923,4 +923,19 @@ public class CompleteParseASTTemplateTest extends CompleteParseBaseTest {
|
||||||
//we aren't going to be completely correct about references to explicit specializations
|
//we aren't going to be completely correct about references to explicit specializations
|
||||||
//due to limitations in the implementation, see bug 59811
|
//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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2561,6 +2561,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
List references = new ArrayList();
|
List references = new ArrayList();
|
||||||
IContainerSymbol ownerScope = scopeToSymbol( scope );
|
IContainerSymbol ownerScope = scopeToSymbol( scope );
|
||||||
|
|
||||||
|
if( name == null )
|
||||||
|
handleProblem( IProblem.SEMANTIC_NAME_NOT_PROVIDED, null, startingOffset, nameEndOffset, nameLine );
|
||||||
|
|
||||||
if(name.getSegmentCount() > 1)
|
if(name.getSegmentCount() > 1)
|
||||||
{
|
{
|
||||||
ISymbol symbol = lookupQualifiedName( ownerScope,
|
ISymbol symbol = lookupQualifiedName( ownerScope,
|
||||||
|
@ -3219,6 +3222,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
|
|
||||||
IContainerSymbol newScope = pst.newContainerSymbol(EMPTY_STRING, TypeInfo.t_block);
|
IContainerSymbol newScope = pst.newContainerSymbol(EMPTY_STRING, TypeInfo.t_block);
|
||||||
newScope.setContainingSymbol(symbol);
|
newScope.setContainingSymbol(symbol);
|
||||||
|
newScope.setIsTemplateMember( symbol.isTemplateMember() );
|
||||||
|
|
||||||
ASTCodeScope codeScope = new ASTCodeScope( newScope );
|
ASTCodeScope codeScope = new ASTCodeScope( newScope );
|
||||||
attachSymbolExtension( newScope, codeScope, true );
|
attachSymbolExtension( newScope, codeScope, true );
|
||||||
|
|
|
@ -1238,7 +1238,8 @@ public class ParserSymbolTable {
|
||||||
static private void releaseCosts( Cost [] costs ){
|
static private void releaseCosts( Cost [] costs ){
|
||||||
if( costs != null ) {
|
if( costs != null ) {
|
||||||
for( int i = 0; i < costs.length; i++ ){
|
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(){
|
public static synchronized int numAllocated(){
|
||||||
int num = 0;
|
// int num = 0;
|
||||||
for( int i = 0; i < POOL_SIZE; i++ ){
|
// for( int i = 0; i < POOL_SIZE; i++ ){
|
||||||
if( !free[i] )
|
// if( !free[i] )
|
||||||
num++;
|
// num++;
|
||||||
}
|
// }
|
||||||
return num;
|
// return num;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue