[cfe-dev] Running CLang as a preprocessor

Stefan Seefeld seefeld at sympatico.ca
Wed Jan 19 16:44:55 PST 2011


On 2011-01-19 19:34, Douglas Gregor wrote:
> There is no way to invoke (only) the preprocessor through the libclang 
> interface, although you can get at the artifacts of preprocessing 
> (inclusions, macro definitions, macro instantiations, etc.) through 
> the cursor interface.

Thanks.

For context: With Synopsis I'm providing preprocessing as a separate 
step. That is useful as I'm not only targeting C and C++, but also e.g. 
IDL, which requires a preprocessor. Also, in some cases I want to get 
the preprocessor info (such as header inclusion graph), even though the 
actual C++ code can't be parsed without errors.

Can CLang be used to provide that info even if the parse step would 
yield compilation errors ? If not, would that be a useful feature to add 
to the wishlist ?

Thanks,
         Stefan

-- 

       ...ich hab' noch einen Koffer in Berlin...




More information about the cfe-dev mailing list