[cfe-dev] How to find usages of Decl

Erik Pilkington via cfe-dev cfe-dev at lists.llvm.org
Mon Apr 22 13:48:12 PDT 2019

That depends, can you provide more context? In general, there isn't a 
cheap way of going from a Decl* to a list of users like in LLVM IR, but 
you can use add some code to Sema::DiagnoseUseOfDecl to find places 
where the Decl is used, or traverse the AST using a ConstStmtVisitor or 
RecursiveASTVisitor, looking for a DeclRefExpr/MemberExpr that refers to 
a specific variable. What kinds of Decls are you looking for, and what 
operation are you planning on doing with it's users?


On 4/22/19 3:09 AM, via cfe-dev wrote:
> Hi all!
> Is here a way to find all usages + references of particular Decl in Sema?
> Thanks!
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list