Skip to content

Commit 182ebe8

Browse files
committed
Deduplicate bindings found both via cache and via nested bindings index
This allows finding unique PDOM binding for members of unnamed namespaces
1 parent 3287d57 commit 182ebe8

File tree

1 file changed

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

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,14 +1415,17 @@ public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, Inde
14151415
public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, boolean isCaseSensitive,
14161416
IndexFilter filter, IProgressMonitor monitor) throws CoreException {
14171417
ArrayList<IIndexFragmentBinding> result = new ArrayList<>();
1418+
HashSet<PDOMBinding> uniqueNodes = new HashSet<>();
14181419
try {
14191420
for (PDOMLinkage linkage : getLinkageList()) {
14201421
if (filter.acceptLinkage(linkage)) {
14211422
if (isCaseSensitive) {
14221423
PDOMBinding[] bindings = linkage.getBindingsViaCache(name, monitor);
14231424
for (PDOMBinding binding : bindings) {
14241425
if (filter.acceptBinding(binding)) {
1425-
result.add(binding);
1426+
if (uniqueNodes.add(binding)) {
1427+
result.add(binding);
1428+
}
14261429
}
14271430
}
14281431
}
@@ -1443,7 +1446,9 @@ public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, bool
14431446

14441447
PDOMBinding[] bindings = visitor.getBindings();
14451448
for (PDOMBinding binding : bindings) {
1446-
result.add(binding);
1449+
if (uniqueNodes.add(binding)) {
1450+
result.add(binding);
1451+
}
14471452
}
14481453
}
14491454
}

0 commit comments

Comments
 (0)