[cfe-dev] Can Clang support multi PCH?

Sebastian Redl sebastian.redl at getdesigned.at
Fri Dec 5 01:00:16 PST 2014


On 05.12.2014 09:21, kaka wrote:
> Can Clang support multi PCH?
That's what the Modules effort is all about.
> I find that PreprocessorOption .ImplicitPCHInclude is a String (which store
> PCH name).
> If I change it to vector or something .
> store multi PCH    Can Clang support Read and Use these PCH?
No, you cannot have multiple PCHs, because PCHs are order-dependent by 
definition. Clang supports "chained" PCH files, where one file refers to 
another to be used as a prefix, but you still only specify one implicit 
PCH include there.

This is not a limitation of Clang's PCHs, it's a fundamental property of 
what a PCH is, and how the compilation model of C works.

See the Modules effort for an attempt to introduce something new that 
has a different compilation model and thus supports multiple PCH-like files.

http://clang.llvm.org/docs/Modules.html

Sebastian



More information about the cfe-dev mailing list