mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +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
|
||||
//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();
|
||||
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 );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue