c++ - How to find declaration of a variable using Clang? -
c++ - How to find declaration of a variable using Clang? -
i'm trying analyse c++ code using clang. next code, i'm able retrieve expr* x
argument of f-> bar(x)
ast. now, want find declaration of x
in order initial value i'm not sure how this. looked expr
documentation in here http://clang.llvm.org/doxygen/classclang_1_1expr.html couldn't find useful.
struct foo { int bar(int x) { homecoming x; } }; int main(){ foo *f; int x = 0, y = 0; int y = f->bar(x); homecoming 0; }
something like
dynamic_cast<const vardecl*>(dynamic_cast<const declrefexpr*>(x)->getdecl())->getinit();
c++ clang
Comments
Post a Comment