[cfe-dev] Getting preprocessed contents of a macro expansion in libclang

Kevin Funk kfunk at kde.org
Fri Aug 8 15:50:47 PDT 2014


Hey there,

I'm currently working on implementing proper tooltips for macro definitions 
and expansions in KDevelop. There, I'd like to show both the macro definition 
body and (if hovering a macro expansion) the expanded macro body.

I can easily retrieve the body for macro definitions using clang_tokenize on 
the definition's extent, but that won't work for macro *expansions*, because I 
only get the token stream *before* the preprocessing happened.

So, am I completely missing something or is this feature just not exposed in 
libclang? If not exposed, can someone point me to the correct location in the 
C++ API where to retrieve that information?

Thanks!

-- 
Kevin Funk | kfunk at kde.org | http://kfunk.org



More information about the cfe-dev mailing list