Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] name resolution and index bindings

Hi Nate,

Glad that you are back.

   - Should lookup() even be returning the composite binding for the
     non-template function?

Only if there are at least two projects and one depends on another. Composite bindings are just wrappers around PDOM bindings. They are used in situations when the index may consist of multiple fragments, i.e. when there are multiple projects with dependencies between them. A composite binding contains a reference to the corresponding PDOM bindings and a reference to the index it belongs to. The index reference cannot be derived from the PDOM binding itself since the same PDOM may participate in more than one index. For example, if project A depends on project B, the B's PDOM may participate in an index containing just that PDOM, or the index that contains both, A's and B's PDOMs.
 
   - If so, should resolveAmbiguities() be filtering it out with
     declaredBefore()?

Definitely.
 
If yes, how should declaredBefore() determine where
     the composite binding for the non-template function was declared?

It should be possible to improve declaredBefore by checking if the index binding is declared in any of the included headers (see CPPSemantics.isReachableFromAst(IASTTranslationUnit, IBinding)) and, if not, using IASTTranslationUnit.getDeclarationsInAST(IBinding) to get declarations in the current translation unit.

I've recently made a change that involved using a local definition of a PDOMCPPVariable to get more complete type information (see EvalBinding.computeType(IASTNode))

-sergey

Back to the top