[cfe-dev] Unique identifier for NamedDecls

Stephen Pegoraro via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 20 22:11:40 PST 2017


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 <spegoraro at tutive.com> 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?


More information about the cfe-dev mailing list