mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
Follow up for bug 264666.
This commit is contained in:
parent
6694822fcb
commit
950242a0f3
4 changed files with 36 additions and 1 deletions
|
@ -5827,6 +5827,19 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
return runtime.totalMemory()-runtime.freeMemory();
|
return runtime.totalMemory()-runtime.freeMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// int n= 0;
|
||||||
|
// int a[]= {0x00, sizeof(n)};
|
||||||
|
public void testNonTrivialInitializer_Bug253690() throws Exception {
|
||||||
|
final String code= getAboveComment();
|
||||||
|
for (ParserLanguage lang : ParserLanguage.values()) {
|
||||||
|
IASTTranslationUnit tu= parse(code, lang, false, true, true);
|
||||||
|
IASTSimpleDeclaration d= getDeclaration(tu, 0);
|
||||||
|
IBinding b= d.getDeclarators()[0].getName().resolveBinding();
|
||||||
|
IASTName[] refs = tu.getReferences(b);
|
||||||
|
assertEquals(1, refs.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// void test() {
|
// void test() {
|
||||||
// const void* p = 1+2;
|
// const void* p = 1+2;
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -127,7 +127,9 @@ public abstract class ASTVisitor {
|
||||||
public boolean includeInactiveNodes= false;
|
public boolean includeInactiveNodes= false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For internal use, only.
|
* Normally neither ambiguous nodes nor their children are visited. By setting
|
||||||
|
* this flag to <code>true</code> ambiguous nodes are visited, their children
|
||||||
|
* are not.
|
||||||
* @noreference This field is not intended to be referenced by clients.
|
* @noreference This field is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
public boolean shouldVisitAmbiguousNodes = false;
|
public boolean shouldVisitAmbiguousNodes = false;
|
||||||
|
|
|
@ -45,6 +45,15 @@ public class ASTQueries {
|
||||||
fFound= true;
|
fFound= true;
|
||||||
return PROCESS_ABORT;
|
return PROCESS_ABORT;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public int visit(ASTAmbiguousNode node) {
|
||||||
|
IASTNode[] alternatives= node.getNodes();
|
||||||
|
for (IASTNode alt : alternatives) {
|
||||||
|
if (!alt.accept(this))
|
||||||
|
return PROCESS_ABORT;
|
||||||
|
}
|
||||||
|
return PROCESS_CONTINUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private static NameSearch NAME_SEARCH= new NameSearch();
|
private static NameSearch NAME_SEARCH= new NameSearch();
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,17 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
((ASTNode) node).setInactive();
|
((ASTNode) node).setInactive();
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int visit(ASTAmbiguousNode node) {
|
||||||
|
node.setInactive();
|
||||||
|
IASTNode[] alternatives= node.getNodes();
|
||||||
|
for (IASTNode alt : alternatives) {
|
||||||
|
if (!alt.accept(this))
|
||||||
|
return PROCESS_ABORT;
|
||||||
|
}
|
||||||
|
return PROCESS_CONTINUE;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected static final int DEFAULT_DESIGNATOR_LIST_SIZE = 4;
|
protected static final int DEFAULT_DESIGNATOR_LIST_SIZE = 4;
|
||||||
|
|
Loading…
Add table
Reference in a new issue