Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345240 - IProblemBinding.getCandidateBindings() reports functions twice (ast-binding and index binding)
Summary: IProblemBinding.getCandidateBindings() reports functions twice (ast-binding a...
Status: REOPENED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-10 05:59 EDT by Thomas Kallenberg CLA
Modified: 2020-09-04 15:24 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Kallenberg CLA 2011-05-10 05:59:14 EDT
Build Identifier: 20110204-0611

If I try to resolve the binding for the name (a) func() in the following code

void func(int i) { }

void testFunc() {
(a)    func();
}

after i ran a full rebuild of the indexer the binding is a problembinding with two candidates. first it finds the function in the local ast (which is a CPPFunction) and then in the indexer (which is of type PDOMCPPFunction)

I think the problem could be in CPPScope function:
getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet, boolean checkPointOfDecl)

first the function gets the function from AST with: getBindingsInAST(name, resolve, prefixLookup, checkPointOfDecl) and later it finds it again with:
index.findBindings(nchars, filter, null).

So, first question: is this behavior correct? Why it reports the same function twice? I cannot see any benefits. Even more, if rely on the number of candidates the behavior is misleading.

Thanx
 Thomas

Reproducible: Always

Steps to Reproduce:
1. Write the global free function
2. rebuild the indexer manually
3. look at the candidates of the problembinding
Comment 1 Markus Schorn CLA 2011-05-11 07:58:48 EDT
It's a problem binding because the argument-list does not match the parameters of the function.
Comment 2 Thomas Kallenberg CLA 2011-05-11 10:48:30 EDT
sure, but the only available candidate of the problembinding is reported twice...
Comment 3 Markus Schorn CLA 2011-05-11 11:47:30 EDT
(In reply to comment #2)
> sure, but the only available candidate of the problembinding is reported
> twice...

Ah, I did not think that this would be an issue.