[clang] [Frontend][PCH]-Add support for ignoring PCH options (-ignore-pch). (PR #142409)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 2 11:19:40 PDT 2025
================
@@ -31,6 +31,16 @@ option:
$ clang -cc1 -include-pch test.h.pch test.c -o test.s
+To ignore PCH options using ``clang -cc1``, use the option `-ignore-pch`:
----------------
MaggieYingYi wrote:
I agree that `-include-pch` is ClangOption and CC1Option and is visible to compiler (`clang`) and compiler frontend (`clang -cc1`). However, `-emit-pch` (NOT `-include-pch`) is CC1Option and is only visible to compiler frontend (clang -cc1) as mentioned in my previous reply.
For example:
If I compile the code using the following command line to check Driver support:
```
$ clang test.h -emit-pch -o test.h.pch
```
I got the following error:
```
clang: error: unknown argument '-emit-pch'; did you mean '-Xclang -emit-pch'?
```
In addition, I found a old PR *https://reviews.llvm.org/D87325) which try to add -emit-pch option to clang driver, but not pass the code review.
I am wondering why `-emit-pch` is CC1 only option but `-include-pch` is both ClangOption and CC1Option?
https://github.com/llvm/llvm-project/pull/142409
More information about the cfe-commits
mailing list