[cfe-dev] Macro history (de-)serialization implementation, need help figuring out some things

Sebastian Redl sebastian.redl at getdesigned.at
Thu Sep 6 23:45:29 PDT 2012


On 06.09.2012 05:03, Richard Smith wrote:
> There is some documentation for PCH and the bitcode format it uses:
>
> http://clang.llvm.org/docs/PCHInternals.html
> http://llvm.org/docs/BitCodeFormat.html
>
> I don't think we have any documentation for PCH chaining.
>
Well, that's grave neglect on my part. I need to rectify this eventually.

For the short term, PCH chaining is pretty simple in idea, if not in 
implementation. Load an existing PCH file, parse some additional code, 
and save the diff between the AST loaded from the PCH and the AST after 
parsing as another PCH file that references the first. Now you have two 
chained PCH files. Load the second, and it will automatically load the 
first and then apply the diff.
This is easy for new AST nodes, but pretty hard for AST mutation. 
Luckily, this is very rare.

Sebastian



More information about the cfe-dev mailing list