Skip to content

Commit 1fb34de

Browse files
committed
Deduplicate bindings found both via cache and via nested bindings index
1 parent c8daec6 commit 1fb34de

File tree

1 file changed

+4
-4
lines changed
  • core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom

1 file changed

+4
-4
lines changed

core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,15 +1414,15 @@ public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, Inde
14141414

14151415
public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, boolean isCaseSensitive,
14161416
IndexFilter filter, IProgressMonitor monitor) throws CoreException {
1417-
ArrayList<IIndexFragmentBinding> result = new ArrayList<>();
1417+
HashSet<PDOMBinding> uniqueNodes = new HashSet<>();
14181418
try {
14191419
for (PDOMLinkage linkage : getLinkageList()) {
14201420
if (filter.acceptLinkage(linkage)) {
14211421
if (isCaseSensitive) {
14221422
PDOMBinding[] bindings = linkage.getBindingsViaCache(name, monitor);
14231423
for (PDOMBinding binding : bindings) {
14241424
if (filter.acceptBinding(binding)) {
1425-
result.add(binding);
1425+
uniqueNodes.add(binding);
14261426
}
14271427
}
14281428
}
@@ -1443,14 +1443,14 @@ public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, bool
14431443

14441444
PDOMBinding[] bindings = visitor.getBindings();
14451445
for (PDOMBinding binding : bindings) {
1446-
result.add(binding);
1446+
uniqueNodes.add(binding);
14471447
}
14481448
}
14491449
}
14501450
}
14511451
} catch (OperationCanceledException e) {
14521452
}
1453-
return result.toArray(new IIndexFragmentBinding[result.size()]);
1453+
return uniqueNodes.toArray(new IIndexFragmentBinding[uniqueNodes.size()]);
14541454
}
14551455

14561456
public IIndexFragmentBinding[] findMacroContainers(char[] prefix, boolean isPrefix, boolean isCaseSensitive,

0 commit comments

Comments
 (0)