[cfe-dev] Using Clang to Expand Macros

David Chisnall David.Chisnall at cl.cam.ac.uk
Thu Nov 22 09:03:54 PST 2012


On 22 Nov 2012, at 16:15, Konstantin Tokarev wrote:

> 22.11.2012, 19:58, "Peter Conn" <conn.peter at gmail.com>:
>> Ah, I'm sorry, I was thinking a bit too in-depth to give all the details I should have - I had meant from in C++ (so using http://clang.llvm.org/doxygen/group__CINDEX.html )
> 
> For C++, I think you should look into clang::Preprocessor [1] and related classes.

Colin is using libclang.  The question is whether there is an API exposed in libclang that allows you to get the expanded text for a macro instantiation.  

David



More information about the cfe-dev mailing list