[cfe-dev] clang headers - can they be included from a memory location?

Graham Wakefield wakefield at mat.ucsb.edu
Sun Oct 17 13:12:45 PDT 2010


It's great that an embedded clang can compile source files supplied as string buffers (rather than files). We wondered if there any way to coerce clang to do something similar for headers? That is, to resolve #include <xxx.h> to use a pre-loaded string buffer of the contents of xxx.h, instead of the file itself? This would make our embedded system much easier to distribute...

I tried using CompilerInstance.getPreprocessorOpts().addRemappedFile(name, buffer), but it doesn't appear that the header search resolves it.  Would a PCH help?

Thanks in advance



More information about the cfe-dev mailing list