Unique identifier for NamedDecls

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Unique identifier for NamedDecls

Boris Kolpackov via cfe-dev
Hi there,

I am migrating a libclang based tool to LibTooling and am a bit stumped on how to uniquely identify a named declaration when traversing the AST. Using libclang I could use clang_getCursorUSR to obtain the unified symbol but my digging through the docs for LibTooling so far has only turned up IdentifierInfo which doesn't give anything unique between function overloads.

Could someone please point me in the right direction?

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Unique identifier for NamedDecls

Boris Kolpackov via cfe-dev
Just a follow-up: I found the required methods in the clang::index
namespace which is great but the other classes there bring up another
question.

I see that I can utilise index::createIndexingAction to generate a
FrontendAction which will hand declarations off to an
IndexDataConsumer subclass.

At the moment I'm using a RecursiveASTVisitor which keeps a reference
to some state that can consist of declarations from multiple
translation units and overriding the HandleXXXXDecl methods there. It
seems that the IndexDataConsumer option might be a better fit, is
there any major reason for/against using it? There is very little
documentation so is it something relatively new?


Thanks for any help!
Steve

On 21 November 2017 at 12:01, Stephen Pegoraro <[hidden email]> wrote:

> Hi there,
>
> I am migrating a libclang based tool to LibTooling and am a bit stumped on
> how to uniquely identify a named declaration when traversing the AST. Using
> libclang I could use clang_getCursorUSR to obtain the unified symbol but my
> digging through the docs for LibTooling so far has only turned up
> IdentifierInfo which doesn't give anything unique between function
> overloads.
>
> Could someone please point me in the right direction?
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev