I have a header header.h
with a macro definition which expands into a class definition and a source file test.cpp
which includes header.h
and uses this macro. Then I use RecursiveASTVisitor
to visit all CXXRecordDecl
's.
When I visit the CXXRecordDecl which is expansion of the macro (in test.cpp) and query for its SourceLocation
and dump()
it, the location points to header.h
- the location of macro definition.
What I need to get for this CXXRecordDecl is the SourceLocation
of macro expansion - in my case it should be test.cpp
.
Thanks in advance.