[llvm-dev] clang_indexTranslationUnit and macro expansions

Andrey Lushnikov via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 29 11:06:03 PDT 2020


Hi!


First of all, thank you for all the work on LLVM. I've been playing with
libclang for a while and it's been an enjoyable experience.


I'm using libclang to build cross-references for a C++ codebase. I use the
`clang_indexTranslationUnit` API, which works very well, but unfortunately

reports declarations and references that are coming from macro expansions.


Now, declarations and references from macro expansions don't really have
locations in source code, so I'd love to ignore them.


My questions are:

- Is there a way to detect declarations and references from macro
expansions?

- If not, shall I switch to `clang_visitChildren` API instead?

- Alternatively, would it be a good idea for me to try contributing a new
`CXIndexOpt_IgnoreMacroExpansions` option to the API?


Thanks,

Andrey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200929/043f73af/attachment.html>


More information about the llvm-dev mailing list