mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
Fix for 176863, StackOverflow parsing ambigous template instanciation.
This commit is contained in:
parent
4eb3deed35
commit
1bc6b14d20
2 changed files with 10 additions and 1 deletions
|
@ -40,7 +40,7 @@ public class CPPASTName extends CPPASTNode implements IASTName {
|
||||||
private static final char[] EMPTY_CHAR_ARRAY = {};
|
private static final char[] EMPTY_CHAR_ARRAY = {};
|
||||||
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final int MAX_RESOLUTION_DEPTH = 3;
|
private static final int MAX_RESOLUTION_DEPTH = 5;
|
||||||
|
|
||||||
private IBinding binding = null;
|
private IBinding binding = null;
|
||||||
private int fResolutionDepth= 0;
|
private int fResolutionDepth= 0;
|
||||||
|
@ -76,6 +76,12 @@ public class CPPASTName extends CPPASTNode implements IASTName {
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incResolutionDepth() {
|
||||||
|
if (binding == null && ++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
|
||||||
|
binding= new RecursionResolvingBinding(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IASTCompletionContext getCompletionContext() {
|
public IASTCompletionContext getCompletionContext() {
|
||||||
IASTNode node = getParent();
|
IASTNode node = getParent();
|
||||||
while (node != null) {
|
while (node != null) {
|
||||||
|
|
|
@ -940,6 +940,9 @@ public class CPPVisitor {
|
||||||
IASTName ns [] = ((ICPPASTQualifiedName)name).getNames();
|
IASTName ns [] = ((ICPPASTQualifiedName)name).getNames();
|
||||||
name = ns[ ns.length - 1 ];
|
name = ns[ ns.length - 1 ];
|
||||||
}
|
}
|
||||||
|
if (name instanceof CPPASTName) {
|
||||||
|
((CPPASTName) name).incResolutionDepth();
|
||||||
|
}
|
||||||
IBinding binding = name.getBinding();
|
IBinding binding = name.getBinding();
|
||||||
if( binding == null ){
|
if( binding == null ){
|
||||||
binding = CPPSemantics.resolveBinding( name );
|
binding = CPPSemantics.resolveBinding( name );
|
||||||
|
|
Loading…
Add table
Reference in a new issue