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 Sergey,

>> 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.
>
> Great! I will give it a try.

I gave it a try, and it fixed the original problem.

However, it introduced a regression in IndexCPPBindingResolutionBugs.
testBug180784. This test case consists of a template class declaration
in a header file, and a template specialization in the cpp file.

After parsing, during ambiguity resolution, resolveBinding() is called
on the template name in the template specialization. lookup() finds
the class template in the form of a PDOMCPPClassTemplate. 
resolveAmbiguities() then tries to determine whether this binding was
declaredBefore() the lookup point.

For some reason, the translation unit's IndexFileSet is empty at this
point. This causes isReachableFromAst() to return false, so we call 
getDeclarationsInAST(), but that calls resolveBinding() on the 
template name again, and we get into a recursion.

Is it expected that the translation unit's IndexFileSet is empty at
that point? If not, I can investigate why it is. If yes, is there
a way to get around the recursion?

Thanks,
Nate 		 	   		  

Back to the top