I am working on CLang 3.5. I am trying to fetch info about variables declared in a C++ project.
How can I fetch datatype or qualified class name of a variable in a clang::VarDecl
, clang::FieldDecl
or clang::ParmVarDecl
object? I tried to find a function which can return datatype or class name of the variable in doc for clang::VarDecl
provided here.
http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html
I also tried to look into the code of $LLVM/tools/clang/tools/clang-check/ClangCheck.cpp
because on passing cmd arg --ast-dump
it shows all of the information about every AST node including all of the variables declared. I wonder how to access all of that information.
I am using ASTMatchers
to find my variable declarations, those are:
fieldDecl().bind("field")
parmVarDecl().bind("param")
varDecl().bind("var")
Can anybody please tell me how can I get datatype of all of the variables delcared?