mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Restore counting iterations in computeContainsDeclaration cycle detector
A follow-up change to bug 509898 missed actually incrementing the counter,
restore it now.
Fixes: 5462bac381
("Bug 509898 - IndexFileSet.containsDeclaration is slow and is causing UI freezes")
This commit is contained in:
parent
0923e66b7b
commit
74621c1048
1 changed files with 5 additions and 6 deletions
|
@ -100,6 +100,11 @@ public class IndexFileSet implements IIndexFileSet {
|
|||
Set<Long> visited = null;
|
||||
long nameRecord;
|
||||
while ((nameRecord = nameIterator.next()) != 0) {
|
||||
if (++iterationCount >= 1000 && visited == null) {
|
||||
// Iteration count is suspiciously high. Start keeping track of visited names
|
||||
// to be able to detect a cycle.
|
||||
visited = new HashSet<>();
|
||||
}
|
||||
if (visited != null && !visited.add(nameRecord)) {
|
||||
// Cycle detected!
|
||||
logInvalidNameChain(pdom, binding);
|
||||
|
@ -114,12 +119,6 @@ public class IndexFileSet implements IIndexFileSet {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
if (iterationCount >= 1000 && visited == null) {
|
||||
// Iteration count is suspiciously high. Start keeping track of visited names
|
||||
// to be able to detect a cycle.
|
||||
visited = new HashSet<>();
|
||||
visited.add(nameRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
|
|
Loading…
Add table
Reference in a new issue