Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 315664 - When using an external PDOM, Open Declaration sometimes pops up dialog with two identical choices
Summary: When using an external PDOM, Open Declaration sometimes pops up dialog with t...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-source-nav (show other bugs)
Version: 7.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 7.0.1   Edit
Assignee: Markus Schorn CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-03 16:09 EDT by Steve Kennedy CLA
Modified: 2010-06-18 05:23 EDT (History)
1 user (show)

See Also:


Attachments
fix (4.13 KB, patch)
2010-06-18 04:19 EDT, Markus Schorn CLA
mschorn.eclipse: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Kennedy CLA 2010-06-03 16:09:49 EDT
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
Comment 1 Markus Schorn CLA 2010-06-18 04:19:25 EDT
Created attachment 172200 [details]
fix

Changed to a more robust strategy to remove duplicate elements.
Comment 2 Markus Schorn CLA 2010-06-18 04:21:23 EDT
Fixed in 7.0.1 > 20100618.