Community
Participate
Working Groups
Build Identifier: M20100211-1343 This happens in the following specific scenario: header file (external to current project): #define FOO(p) foo(42, p) ... // this declaration is required to trigger the problem extern void foo(int, int); Function "foo" is defined in a source file external to the current project. This file is indexed in an external PDOM that has been attached to the project using the org.eclipse.cdt.core.CINDEX ReadOnlyPDOMProvider extension point. Invoking "Open Declaration" on "foo" in the #define line results in "Open Declaration" dialog with two choices for "foo(int, int) - /path/to/source/file". "Open Declaration" on the "foo" in the extern statement goes directly to the source file. Using the debugger I've traced what happens to the method "navigationFallBack" in org.eclipse.cdt.internal.ui.search.actions.OpenDeclarationsJob. The block of code using the ASTNameCollector puts a CPPFunction binding in the primaryBindings set and a CompositeCPPFunction binding in the ignoreIndexBindings set. The CompositeCPPFunction has a linkage to the *local* index pdom. The block of code with the "Search the index, also" comment adds a CompositeCPPFunction binding to the primaryBindings set. This CompositeCPPFunction has a linkage to the *external* index pdom and thus isn't ignored by the !ignoreIndexBindings.contains(idxBinding) test. In the block of code with the "Convert bindings to CElements" comment, the two bindings both end up getting resolved by the external pdom into duplicate elements. Reproducible: Always
Created attachment 172200 [details] fix Changed to a more robust strategy to remove duplicate elements.
Fixed in 7.0.1 > 20100618.
*** cdt cvs genie on behalf of mschorn *** Bug 315664: Duplicate choices in open declaration. [*] OpenDeclarationsJob.java 1.16.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java?root=Tools_Project&r1=1.16&r2=1.16.2.1 [*] OpenDeclarationsJob.java 1.17 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java?root=Tools_Project&r1=1.16&r2=1.17