Code completion in memory buffers


I need code a completion callback in a memory buffer. Naively I thought
I could replace the FileEntry* Preprocessor::CodeCompletionFile by
FileID - but that doesn't work because the interface allows the
completion to be requested on a file that is not yet included. I could
duplicate every code completion interface there is to alternatively take
a MemoryBuffer* - but that sounds horrible.

Is there a common concept for "file" and "buffer" that I could use for
the interface?

Cheers, Axel.

Is there a reason why you are not using libclang, which allows you to provide unsaved files as buffers for doing exactly this?