<div dir="ltr">Hi!<br><br>I'm trying to implement a primitive reaching definitions algorithm for C++, but am struggling a bit. I'd like to make all function calls be definitions of global/static variables, but I can't seem to retrieve them.<div><br></div><div>I tried using AST matchers (match() to be precise) on a TranslationUnitDecl, but I can't seem to be able to match varDecl()s at all. Is there a reason for this? When I use clang-query, "m varDecl()" works like a charm, but match() doesn't seem to.</div><div><br></div><div>In any case, I can retrieve local variables by matching declStmt() and some non-local ones when inspecting the LHS of assignments (I need to do this anyways to find all definitions), but I feel like I'm not the first person trying to recover all accessible variables to a function. Could anyone give me some guidance please? :)</div><div></div><div><br></div><div>Cheers!<br>Kristóf</div><div><br></div><div>P.S. This is the patch I'm working on: <a href="https://reviews.llvm.org/D64991">https://reviews.llvm.org/D64991</a></div></div>