mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Bug 509898 - IndexFileSet.containsDeclaration is slow and is causing UI
freezes Fixed logging of cycles in IndexFileSet.containsDeclaration. Change-Id: Ic27b161aacb7706f8f06beb1f876f86100421328
This commit is contained in:
parent
64f00b9457
commit
2899b9098e
3 changed files with 23 additions and 6 deletions
|
@ -144,8 +144,8 @@ public class IndexFileSet implements IIndexFileSet {
|
|||
PDOMName first = listType.equals("declarations") ? pdomBinding.getFirstDeclaration() : pdomBinding.getFirstDefinition(); //$NON-NLS-1$
|
||||
for (PDOMName name = first; name != null; name= name.getNextInBinding()) {
|
||||
if (nameChain.length() != 0)
|
||||
nameChain.append(", "); //$NON-NLS-1$
|
||||
nameChain.append(name.getRecord());
|
||||
nameChain.append('\n');
|
||||
nameChain.append(String.format("%s @%d", String.valueOf(name.getSimpleID()), name.getRecord())); //$NON-NLS-1$
|
||||
PDOMBinding nameBinding = name.getBinding();
|
||||
if (!nameBinding.equals(binding)) {
|
||||
nameChain.append(String.format(" belongs to %s (%s) @%d", //$NON-NLS-1$
|
||||
|
@ -154,7 +154,7 @@ public class IndexFileSet implements IIndexFileSet {
|
|||
((PDOMNode) nameBinding).getRecord()));
|
||||
}
|
||||
if (!visited.add(name)) {
|
||||
CCorePlugin.log(String.format("IndexFileSet: %s (%s) @%d - list of %s contains a cycle: ", //$NON-NLS-1$
|
||||
CCorePlugin.log(String.format("IndexFileSet: %s (%s) @%d - list of %s contains a cycle:\n%s", //$NON-NLS-1$
|
||||
String.join("::", binding.getQualifiedName()), //$NON-NLS-1$
|
||||
binding.getClass().getSimpleName(),
|
||||
pdomBinding.getRecord(),
|
||||
|
|
|
@ -143,7 +143,7 @@ public class PDOMFile implements IIndexFragmentFile {
|
|||
return record;
|
||||
}
|
||||
|
||||
public PDOM getPDOM() {
|
||||
public final PDOM getPDOM() {
|
||||
return fLinkage.getPDOM();
|
||||
}
|
||||
|
||||
|
@ -153,14 +153,14 @@ public class PDOMFile implements IIndexFragmentFile {
|
|||
return true;
|
||||
if (obj instanceof PDOMFile) {
|
||||
PDOMFile other = (PDOMFile) obj;
|
||||
return fLinkage.getPDOM().equals(other.getLinkage().getPDOM()) && record == other.record;
|
||||
return getPDOM() == other.getPDOM() && record == other.record;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return System.identityHashCode(fLinkage.getPDOM()) + (int) (41 * record);
|
||||
return System.identityHashCode(getPDOM()) + (int) (41 * record);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -224,6 +224,23 @@ public final class PDOMName implements IIndexFragmentName, IASTFileLocation {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object obj) {
|
||||
if (obj == this)
|
||||
return true;
|
||||
if (obj instanceof PDOMName) {
|
||||
PDOMName other = (PDOMName) obj;
|
||||
return record == other.record && linkage.equals(other.linkage);
|
||||
}
|
||||
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return linkage.hashCode() + (int) (41 * record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new String(getSimpleID());
|
||||
|
|
Loading…
Add table
Reference in a new issue