How to get preprocessed source?

How would I go about getting the preprocessed source in a string?
Repeatedly calling getPreprocessor().Lex(token) gives me the tokens,
but none of the white space between. Essentially I'd like the
equivalent of a "clang -E -P foo.c" in a string.

Hi Robert,

Take a look at clang::DoPrintPreprocessedInput.

http://clang.llvm.org/doxygen/namespaceclang.html#a8f3083b46a33764cacbe03db4aaa4da0

Cheers,