[cfe-dev] Running CLang as a preprocessor

Stefan Seefeld seefeld at sympatico.ca
Wed Jan 19 15:40:24 PST 2011

Is it possible to use libclang to preprocess source code, i.e. skip the 
actual parsing ?

I have tried  clang_parseTranslationUnit(), passing "-E" in the flags 
argument, but that didn't have the desired effect. (It gave me a 
"warning: argument unused during compilation: '-fsyntax-only'" warning 
and then did the parse anyhow.)

Is there another libclang function I should use instead ? (I'm 
interested in all the normal preprocessor information, such as header 
inclusions, macro definitions, and macro expansions.



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

More information about the cfe-dev mailing list