How to find usages of Decl

Hi all!
Is here a way to find all usages + references of particular Decl in Sema?


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?