Bigcheese wrote: > What does the code that reads these files look like, could we leverage that > somehow?
You can call `clang::ObjectFilePCHContainerReader::ExtractPCH()` and then check the magic. This lives in the CodeGen library which I don't think the driver currently (or should) links against, but this is the best way to know if something is valid. > An alternative would be turn the logic around, and only ignore GCC PCH files > (I believe they all start with the file magic `gpch`). However I do think > that the current approach of "whitelisting" the kind of file we're looking > for is better. I would be fine with this approach, but agree that it's best if we can be more selective. My concern is that `clang::ObjectFilePCHContainerReader::ExtractPCH()` and this detection may get out of sync, as support for `-gmodules` is automatic anytime someone adds a new object format. https://github.com/llvm/llvm-project/pull/77711 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits