How to get location of variable name in clang::VarDecl

后端 未结 1 1190
盖世英雄少女心
盖世英雄少女心 2021-01-05 14:11

I\'m using clang 3.0 library for some analysis of C/C++ code, and I need to get location of variable declaration, I tried this code:

clang::VarDecl * vd = ..         


        
相关标签:
1条回答
  • 2021-01-05 14:42

    I'm currently not in the position to test it but I think you want to extract the SourceLocation obtained by getLocation() from your VarDecl. This function is actually defined by the Decl base class. Although it seems to identify just one location it seems to be usable to identify the entire name (I haven't tried to extract its individual ends, however, just used it to indicate the variable).

    0 讨论(0)
提交回复
热议问题