mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 419614 - Work around a stack overflow caused by a circular reference
between inline namespaces Change-Id: I1e55b0ddb47f888dab777ff4d5ea8f9a6e4d2e10 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
This commit is contained in:
parent
184730559b
commit
14f7d3e16c
1 changed files with 15 additions and 2 deletions
|
@ -231,6 +231,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Conversions.UDCMod
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Cost.Rank;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Cost.Rank;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name resolution
|
* Name resolution
|
||||||
|
@ -1075,12 +1076,24 @@ public class CPPSemantics {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void lookupInlineNamespaces(LookupData data, ICPPNamespaceScope namespace) throws DOMException {
|
private static void lookupInlineNamespaces(LookupData data, ICPPNamespaceScope namespace)
|
||||||
|
throws DOMException {
|
||||||
|
lookupInlineNamespaces(data, namespace, new HashSet<ICPPInternalNamespaceScope>());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void lookupInlineNamespaces(LookupData data, ICPPNamespaceScope namespace,
|
||||||
|
Set<ICPPInternalNamespaceScope> visited) throws DOMException {
|
||||||
if (namespace instanceof ICPPInternalNamespaceScope) {
|
if (namespace instanceof ICPPInternalNamespaceScope) {
|
||||||
ICPPInternalNamespaceScope ns= (ICPPInternalNamespaceScope) namespace;
|
ICPPInternalNamespaceScope ns= (ICPPInternalNamespaceScope) namespace;
|
||||||
|
visited.add(ns);
|
||||||
for (ICPPInternalNamespaceScope inline : ns.getInlineNamespaces()) {
|
for (ICPPInternalNamespaceScope inline : ns.getInlineNamespaces()) {
|
||||||
|
if (visited.contains(inline)) {
|
||||||
|
CCorePlugin.log(IStatus.WARNING,
|
||||||
|
"Detected circular reference between inline namespaces"); //$NON-NLS-1$
|
||||||
|
continue;
|
||||||
|
}
|
||||||
mergeResults(data, getBindingsFromScope(inline, data), true);
|
mergeResults(data, getBindingsFromScope(inline, data), true);
|
||||||
lookupInlineNamespaces(data, inline);
|
lookupInlineNamespaces(data, inline, visited);
|
||||||
nominateNamespaces(data, inline);
|
nominateNamespaces(data, inline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue