mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Bug 509774 - StackOverflowError in IndexCPPSignatureUtil.getSignature
Change-Id: Ied4755f3bb3013460aae2584c3941b606102e55b
This commit is contained in:
parent
526f11aabd
commit
b6c2d930f4
1 changed files with 27 additions and 7 deletions
|
@ -17,7 +17,9 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -103,6 +105,13 @@ public class ASTTypeUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ThreadLocal<ResultCache> resultCache = new ThreadLocal<>();
|
private static final ThreadLocal<ResultCache> resultCache = new ThreadLocal<>();
|
||||||
|
private static final ThreadLocal<Set<IBinding>> fSourceFileOnlyCheckInProgress=
|
||||||
|
new ThreadLocal<Set<IBinding>>() {
|
||||||
|
@Override
|
||||||
|
protected Set<IBinding> initialValue() {
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private ASTTypeUtil() {}
|
private ASTTypeUtil() {}
|
||||||
|
|
||||||
|
@ -852,13 +861,24 @@ public class ASTTypeUtil {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
IASTNode node = ASTInternal.getDeclaredInSourceFileOnly(binding);
|
// The ASTInternal.getDeclaredInSourceFileOnly method may call this method
|
||||||
if (node != null) {
|
// recursively for the same binding. Since a nested call is done to check if
|
||||||
IPath filePath = new Path(node.getTranslationUnit().getFilePath());
|
// the binding has a declaration outside of the source file, inside the nested
|
||||||
URI uri = UNCPathConverter.getInstance().toURI(filePath);
|
// call we assume that the binding is not local to the source file.
|
||||||
result.append('{');
|
// See http://bugs.eclipse.org/509774
|
||||||
result.append(uri.toString());
|
if (fSourceFileOnlyCheckInProgress.get().add(binding)) {
|
||||||
result.append('}');
|
try {
|
||||||
|
IASTNode node = ASTInternal.getDeclaredInSourceFileOnly(binding);
|
||||||
|
if (node != null) {
|
||||||
|
IPath filePath = new Path(node.getTranslationUnit().getFilePath());
|
||||||
|
URI uri = UNCPathConverter.getInstance().toURI(filePath);
|
||||||
|
result.append('{');
|
||||||
|
result.append(uri.toString());
|
||||||
|
result.append('}');
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
fSourceFileOnlyCheckInProgress.get().remove(binding);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue