[PATCH] D104465: [clang][deps] Prevent PCH validation failures by padding minimized files

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 17 15:15:26 PDT 2021


dexonsmith added a comment.

In D104465#2825343 <https://reviews.llvm.org/D104465#2825343>, @dexonsmith wrote:

> A few other ideas:
>
> 1. Disable PCH validation when minimizing. (Is that less robust than your current workaround? If so, can you explain why?)
> 2. Use the original PCH header in the scanning `-cc1`s (translate `-include-pch` to `-include`) and switch back in the generated `-cc1`s (back to `-include-pch`).
> 3. Embed instructions in the PCH for how to build it, and make a "minimized" version of the PCH.

Two more options to consider:

4. If a compilation uses a PCH, use the original files for any input file transitively referenced by the PCH. Can be done by using a filesystem overlay that skips over the minimization layer for those files, or could tell the minimization layer not to minimize those files. You can figure out the files by adding a free function that preloads the PCH and extracts out all the input files.
5. Add support for building/using a PCH, and only support PCHes that are built this way. E.g., add a `-include-pch-auto` option or something. Scanner would use `-include`, spit out a command for building a PCH using explicit modules, and the generated `-cc1`s would use `-include-pch` to refer to it. This way all the modules are generated "in house".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104465/new/

https://reviews.llvm.org/D104465



More information about the cfe-commits mailing list