1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 491834 - Revert the earlier attempt to guard against infinite recursion in HeuristicResolver

Change-Id: I22bd9deb13824a82f081c12051770f8d314b11e6
This commit is contained in:
Nathan Ridge 2016-04-21 01:39:23 -04:00
parent a75ce4027b
commit 3e4e14f0d6

View file

@ -100,15 +100,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
* implementing more advanced heuristics that could deal with this.
*/
public class HeuristicResolver {
// Infrastructure to protect against infinite recursion in heuristic resolution.
private static final int RESOLUTION_DEPTH_LIMIT = 32;
private static final ThreadLocal<Integer> fResolutionDepth = new ThreadLocal<Integer>() {
@Override
protected Integer initialValue() {
return 0;
}
};
/**
* Given a dependent type, heuristically tries to find a concrete scope (i.e. not an unknown scope)
* for it.
@ -395,15 +386,6 @@ public class HeuristicResolver {
*/
private static IType resolveUnknownTypeOnce(ICPPUnknownType type, Set<HeuristicLookup> lookupSet,
IASTNode point) {
// Guard against infinite recursion.
int resolutionDepth = fResolutionDepth.get();
if (resolutionDepth > RESOLUTION_DEPTH_LIMIT) {
return type;
}
// Increment the resolution depth for the duration of this call.
fResolutionDepth.set(resolutionDepth + 1);
try {
if (type instanceof ICPPDeferredClassInstance) {
ICPPDeferredClassInstance deferredInstance = (ICPPDeferredClassInstance) type;
return deferredInstance.getClassTemplate();
@ -475,10 +457,6 @@ public class HeuristicResolver {
}
}
}
} finally {
// Restore original resolution depth.
fResolutionDepth.set(resolutionDepth);
}
return null;
}