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



On Fri, Dec 19, 2014 at 11:22 PM, Nathan Ridge <zeratul976@xxxxxxxxxxx> wrote:
Hi Sergey,

I know this thread is more than a year old, but I'm resurrecting it because I'd like to finish fixing bug 402498.

>> [H]ow should declaredBefore() determine where
>> [an index binding] 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.

Why is the second step necessary? I would think that checking if the index binding is declared in an included header is sufficient, because if the binding is in the current translation unit, we would have an AST binding instead of an index binding.

You are absolutely right. I don't know what I was thinking when I wrote the second part of the sentence you quoted.

I have implemented just the first step (having declaredBefore() for an index binding check if it is declared in an included header), and I'm finding that it doesn't break any tests (but perhaps there's something I'm missing and that the tests don't catch).

This is great. The promiscuous binding resolution bothered me for a long time. The change probably didn't break tests because I recently changed all index tests to generate proper includes. Glad that it appears to work.

Thanks,
Nate

-sergey 

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev

Back to the top