Skip to content

[Frontend][PCH]-Add support for ignoring PCH options (-ignore-pch). #142409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

MaggieYingYi
Copy link
Contributor

@MaggieYingYi MaggieYingYi commented Jun 2, 2025

Visual Studio has an argument to ignore all PCH related switches. clang-cl has also support option /Y-. Having the same option in clang would be helpful. This commit is to add support for ignoring PCH options (-ignore-pch).

@MaggieYingYi MaggieYingYi self-assigned this Jun 2, 2025
@MaggieYingYi MaggieYingYi added clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:PCH Precompiled headers labels Jun 2, 2025
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jun 2, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 2, 2025

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: None (MaggieYingYi)

Changes

As part of the mixed host bring up, the support of PCH (precompiled headers) has been raised as a potential issue. Visual Studio has an argument to ignore all PCH related switches. clang-cl has also support option /Y-. Having the same option in clang would be helpful. This commit is to add support for ignoring PCH options (-ignore-pch).


Full diff: https://github.com/llvm/llvm-project/pull/142409.diff

6 Files Affected:

  • (modified) clang/docs/PCHInternals.rst (+10)
  • (modified) clang/docs/UsersManual.rst (+14)
  • (modified) clang/include/clang/Driver/Options.td (+2)
  • (modified) clang/lib/Frontend/CompilerInvocation.cpp (+9)
  • (added) clang/test/PCH/Inputs/ignored-pch.h (+6)
  • (added) clang/test/PCH/ignored-pch.c (+114)
diff --git a/clang/docs/PCHInternals.rst b/clang/docs/PCHInternals.rst
index 079fba16711dc..de0b341460cac 100644
--- a/clang/docs/PCHInternals.rst
+++ b/clang/docs/PCHInternals.rst
@@ -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`:
+
+.. code-block:: bash
+
+  $ clang -cc1 test.h -emit-pch -ignore-pch -o test.h.pch
+  $ clang -cc1 -include-pch test.h.pch -ignore-pch test.c -o test.s
+
+This option disables precompiled headers, overrides -emit-pch and -include-pch.
+test.h.pch is not generated and not used as a prefix header.
+
 Design Philosophy
 -----------------
 
diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index eb9a812f0c1c9..f12b6b4c02193 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -1458,6 +1458,20 @@ will be processed from the PCH file. Otherwise, Clang will report an error.
   ``test.h`` since ``test.h`` was included directly in the source file and not
   specified on the command line using ``-include-pch``.
 
+Ignoring a PCH File
+^^^^^^^^^^^^^^^^^^^
+
+To ignore a PCH file using Clang, the `-Xclang -ignore-pch` option is passed to
+``clang``:
+
+.. code-block:: console
+
+  $ clang -x c-header test.h -Xclang -ignore-pch -o test.h.pch
+  $ clang -include-pch test.h.pch -Xclang -ignore-pch test.c -o test
+
+This option disables precompiled headers, overrides -emit-pch and -include-pch.
+test.h.pch is not generated and not used as a prefix header.
+
 Relocatable PCH Files
 ^^^^^^^^^^^^^^^^^^^^^
 
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 5ca31c253ed8f..3ed87608bf592 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -8127,6 +8127,8 @@ def emit_header_unit : Flag<["-"], "emit-header-unit">,
   HelpText<"Generate C++20 header units from header files">;
 def emit_pch : Flag<["-"], "emit-pch">,
   HelpText<"Generate pre-compiled header file">;
+def ignore_pch : Flag<["-"], "ignore-pch">,
+  HelpText<"Ignore pre-compiled header options">;
 def emit_llvm_only : Flag<["-"], "emit-llvm-only">,
   HelpText<"Build ASTs and convert to LLVM, discarding output">;
 def emit_codegen_only : Flag<["-"], "emit-codegen-only">,
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 2c02719121c73..19f81ff2fbe9d 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2982,6 +2982,15 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
 #undef FRONTEND_OPTION_WITH_MARSHALLING
 
   Opts.ProgramAction = frontend::ParseSyntaxOnly;
+
+  // If -ignore-pch is used, all pch handling is disabled. clang pch-related
+  // flags are removed.
+  if (Args.hasArg(options::OPT_ignore_pch)) {
+    Args.eraseArg(options::OPT_emit_pch);
+    Args.eraseArg(options::OPT_include_pch);
+    Args.eraseArg(options::OPT_ignore_pch);
+  }
+
   if (const Arg *A = Args.getLastArg(OPT_Action_Group)) {
     OptSpecifier Opt = OptSpecifier(A->getOption().getID());
     std::optional<frontend::ActionKind> ProgramAction = getFrontendAction(Opt);
diff --git a/clang/test/PCH/Inputs/ignored-pch.h b/clang/test/PCH/Inputs/ignored-pch.h
new file mode 100644
index 0000000000000..0956f9da1cb16
--- /dev/null
+++ b/clang/test/PCH/Inputs/ignored-pch.h
@@ -0,0 +1,6 @@
+#ifndef IGNORED_PCH_H
+#define IGNORED_PCH_H
+inline int f() {
+  return 42;
+}
+#endif // IGNORED_PCH_H
\ No newline at end of file
diff --git a/clang/test/PCH/ignored-pch.c b/clang/test/PCH/ignored-pch.c
new file mode 100644
index 0000000000000..198ad0fde7d05
--- /dev/null
+++ b/clang/test/PCH/ignored-pch.c
@@ -0,0 +1,114 @@
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -o %t.ll
+// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Check that -ignore-pch causes -emit-pch and -include-pch options to be ignored.
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -ignore-pch -emit-pch -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -ignore-pch -emit-llvm -o %t.ll
+// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Check that -ignore-pch is passed through Driver.
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang -x c-header %S/Inputs/ignored-pch.h -Xclang -emit-pch -o %t.pch
+// RUN: %clang -S %s -include-pch %t.pch -Xclang -emit-llvm -o %t.ll
+// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang -x c-header %S/Inputs/ignored-pch.h -Xclang -ignore-pch -Xclang -emit-pch -o %t.pch
+// RUN: %clang -S %s -include-pch %t.pch -Xclang -ignore-pch -Xclang -emit-llvm -o %t.ll
+// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Check that -ignore-pch works for multiple PCH related options.
+// Test with -building-pch-with-obj.
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -ignore-pch -emit-pch -building-pch-with-obj -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -ignore-pch -emit-llvm -building-pch-with-obj -o %t.ll
+// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Test with -fallow-pch-with-compiler-errors.
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -ignore-pch -emit-pch -fallow-pch-with-compiler-errors -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -ignore-pch -emit-llvm -fallow-pch-with-compiler-errors -o %t.ll
+// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Test with -fallow-pch-with-different-modules-cache-path.
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fallow-pch-with-different-modules-cache-path -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fallow-pch-with-different-modules-cache-path -o %t.ll
+// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Test with -fpch-codegen.
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fpch-codegen -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fpch-codegen -o %t.ll
+// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Test with -fpch-debuginfo.
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fpch-debuginfo -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fpch-debuginfo -o %t.ll
+// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Test with -fpch-instantiate-templates.
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fpch-instantiate-templates -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fpch-instantiate-templates -o %t.ll
+// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Test with -fno-pch-timestamp.
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fno-pch-timestamp -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fno-pch-timestamp -o %t.ll
+// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Test with -fno-validate-pch.
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fno-validate-pch -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fno-validate-pch -o %t.ll
+// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Test with -relocatable-pch.
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -relocatable-pch -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -relocatable-pch -o %t.ll
+// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Test with -pch-through-hdrstop-create/-pch-through-hdrstop-use
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -pch-through-hdrstop-create -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -pch-through-hdrstop-use -o %t.ll
+// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
+// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+
+// Test with AST dump output:
+// RUN: rm -rf %t.pch %t.ll
+// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -o %t.pch
+// RUN: %clang_cc1 %s -include-pch %t.pch -ast-dump-all | FileCheck --check-prefix=CHECK-AST-PCH %s
+// RUN: %clang_cc1 %s -include-pch %t.pch -ignore-pch -ast-dump-all | FileCheck --check-prefix=CHECK-AST %s
+
+// CHECK-PCH: ignored-pch.c.{{.*}}.pch
+// CHECK-OBJ: ignored-pch.c.{{.*}}.ll
+// CHECK-ERROR: ignored-pch.c.{{.*}}.pch{{'?}}: No such file or directory
+// CHECK-AST-PCH: <undeserialized declarations>
+// CHECK-AST-NOT: <undeserialized declarations>
+
+#include "Inputs/ignored-pch.h"
+#pragma hdrstop
+int main() {
+  return f();
+}

@MaggieYingYi
Copy link
Contributor Author

Thanks @mizvekov for your quick code review. I got a Test Doc build failure https://github.com/llvm/llvm-project/actions/runs/15397135588. Following the build steps, I managed to reproduce the error, but I am not sure how to fix it. Is there any command to format *.rst file? or any suggestion?
Thanks

@mizvekov
Copy link
Contributor

mizvekov commented Jun 2, 2025

Thanks @mizvekov for your quick code review. I got a Test Doc build failure https://github.com/llvm/llvm-project/actions/runs/15397135588. Following the build steps, I managed to reproduce the error, but I am not sure how to fix it. Is there any command to format *.rst file? or any suggestion? Thanks

https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html

The error says unexpected indentation. Just a guess, but maybe you got tabs and spaces mixed up.

@MaggieYingYi
Copy link
Contributor Author

https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html

Thanks for the information and suggestion. Although the error is not related with this PR, I have fixed by removing unnecessary spaces. Please see MaggieYingYi@a3da3bc for the details. The document test passed here .

@llvmbot llvmbot added the clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' label Jun 4, 2025
Copy link
Contributor

@mizvekov mizvekov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM on the implementation.

I have no objections to the flag itself either.

This is missing a Release note, please add it before merging.

CC @ChuanqiXu9

Please wait at least a couple of days before merging for other comments and opinions.

@MaggieYingYi
Copy link
Contributor Author

Thanks @mizvekov. I am away until next Monday. I will add a release note next Monday. Many thanks again

@MaggieYingYi
Copy link
Contributor Author

This is missing a Release note, please add it before merging.

Added in the commit MaggieYingYi@8a7df93. @mizvekov, could you please help me review the release note? Thanks

@MaggieYingYi MaggieYingYi force-pushed the yingyi/main/PCH branch 3 times, most recently from df4a274 to d29caae Compare June 10, 2025 10:41
Visual Studio has an argument to ignore all PCH related switches. clang-cl has also support option /Y-. Having the same option in clang would be helpful. This commit is to add support for ignoring PCH options (-ignore-pch).

The commit includes:

1. Implement -ignore-pch as a Driver option.
2. Add a Driver test and a PCH test.
3. Add a section of -ignore-pch to user manual.
4. Add a release note for the new option '-ignore-pch'.

Code reviewed by: Matheus Izvekov <[email protected]>
@MaggieYingYi MaggieYingYi merged commit 4fb81f1 into llvm:main Jun 10, 2025
7 of 8 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 10, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building clang at step 5 "compile-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/7030

Here is the relevant piece of the build log for the reference
Step 5 (compile-openmp) failure: build (failure)
...
0.142 [387/130/170] Generating /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/include/amdgcn-amd-amdhsa/llvm-libc-decls/ctype.h
0.142 [386/130/171] Generating /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/include/amdgcn-amd-amdhsa/llvm-libc-decls/stdlib.h
0.143 [385/130/172] Generating /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/include/amdgcn-amd-amdhsa/llvm-libc-decls/locale.h
0.143 [384/130/173] Generating header locale.h from /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/runtimes/../libc/include/locale.yaml
0.143 [383/130/174] Generating /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/include/amdgcn-amd-amdhsa/llvm-libc-decls/uchar.h
0.144 [382/130/175] Generating header uchar.h from /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/runtimes/../libc/include/uchar.yaml
0.144 [381/130/176] Generating /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/include/amdgcn-amd-amdhsa/llvm-libc-decls/time.h
0.144 [380/130/177] Generating /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/include/amdgcn-amd-amdhsa/llvm-libc-decls/signal.h
0.145 [379/130/178] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strcasestr.dir/strcasestr.cpp.o
0.146 [378/130/179] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.o
FAILED: libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.o 
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/./bin/clang++ --target=amdgcn-amd-amdhsa -DLIBC_NAMESPACE=__llvm_libc_21_0_0_git -D__LIBC_USE_FLOAT16_CONVERSION -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc -isystem /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/include/amdgcn-amd-amdhsa -O3 -DNDEBUG --target=amdgcn-amd-amdhsa -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS "-DLIBC_MATH=(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES | LIBC_MATH_NO_ERRNO | LIBC_MATH_NO_EXCEPT)" -fpie -DLIBC_FULL_BUILD -nostdlibinc -ffixed-point -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -nogpulib -fvisibility=hidden -fconvergent-functions -flto -Wno-multi-gpu -Xclang -mcode-object-version=none -DLIBC_COPT_PUBLIC_PACKAGING -UNDEBUG -MD -MT libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.o -MF libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.o.d -o libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.o -c /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/src/stdlib/memalignment.cpp
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/src/stdlib/memalignment.cpp:20:3: error: unknown type name 'uintptr_t'
   20 |   uintptr_t addr = reinterpret_cast<uintptr_t>(p);
      |   ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/libc/src/stdlib/memalignment.cpp:20:37: error: unknown type name 'uintptr_t'
   20 |   uintptr_t addr = reinterpret_cast<uintptr_t>(p);
      |                                     ^
2 errors generated.
0.146 [378/129/180] Generating header stdlib.h from /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/runtimes/../libc/include/stdlib.yaml
0.146 [378/128/181] Generating /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/include/amdgcn-amd-amdhsa/llvm-libc-decls/stdio.h
0.146 [378/127/182] Generating header time.h from /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/runtimes/../libc/include/time.yaml
0.146 [378/126/183] Generating header stdio.h from /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/runtimes/../libc/include/stdio.yaml
0.152 [378/125/184] Generating header signal.h from /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/runtimes/../libc/include/signal.yaml
0.180 [378/124/185] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.common_constants.dir/common_constants.cpp.o
0.202 [378/123/186] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strnlen.dir/strnlen.cpp.o
0.205 [378/122/187] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_trailing_ones_ul.dir/stdc_trailing_ones_ul.cpp.o
0.205 [378/121/188] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_count_ones_ui.dir/stdc_count_ones_ui.cpp.o
0.206 [378/120/189] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strrchr.dir/strrchr.cpp.o
0.208 [378/119/190] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strpbrk.dir/strpbrk.cpp.o
0.210 [378/118/191] Building CXX object libc/src/errno/CMakeFiles/libc.src.errno.errno.dir/libc_errno.cpp.o
0.211 [378/117/192] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strsep.dir/strsep.cpp.o
0.211 [378/116/193] Building CXX object libc/src/ctype/CMakeFiles/libc.src.ctype.iscntrl_l.dir/iscntrl_l.cpp.o
0.213 [378/115/194] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_bit_ceil_ul.dir/stdc_bit_ceil_ul.cpp.o
0.214 [378/114/195] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_leading_zeros_ul.dir/stdc_leading_zeros_ul.cpp.o
0.214 [378/113/196] Building CXX object libc/src/ctype/CMakeFiles/libc.src.ctype.isalnum_l.dir/isalnum_l.cpp.o
0.214 [378/112/197] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_trailing_zeros_uc.dir/stdc_trailing_zeros_uc.cpp.o
0.215 [378/111/198] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_leading_zeros_uc.dir/stdc_leading_zeros_uc.cpp.o
0.215 [378/110/199] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_leading_zeros_ull.dir/stdc_leading_zeros_ull.cpp.o
0.215 [378/109/200] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_trailing_zeros_ui.dir/stdc_trailing_zeros_ui.cpp.o
0.215 [378/108/201] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_leading_zeros_ui.dir/stdc_leading_zeros_ui.cpp.o
0.215 [378/107/202] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_trailing_zeros_us.dir/stdc_trailing_zeros_us.cpp.o
0.216 [378/106/203] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_leading_zeros_us.dir/stdc_leading_zeros_us.cpp.o
0.218 [378/105/204] Building CXX object libc/src/ctype/CMakeFiles/libc.src.ctype.isblank_l.dir/isblank_l.cpp.o
0.219 [378/104/205] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_leading_ones_us.dir/stdc_leading_ones_us.cpp.o
0.220 [378/103/206] Building CXX object libc/src/ctype/CMakeFiles/libc.src.ctype.isalnum.dir/isalnum.cpp.o
0.220 [378/102/207] Building CXX object libc/src/ctype/CMakeFiles/libc.src.ctype.isgraph_l.dir/isgraph_l.cpp.o
0.220 [378/101/208] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_trailing_ones_ui.dir/stdc_trailing_ones_ui.cpp.o
0.221 [378/100/209] Building CXX object libc/src/stdbit/CMakeFiles/libc.src.stdbit.stdc_bit_width_ul.dir/stdc_bit_width_ul.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 10, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-4 while building clang at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/21187

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang :: Modules/crash-vfs-include-pch.m' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
rm -rf /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp # RUN: at line 3
+ rm -rf /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp
mkdir -p /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/m /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/out # RUN: at line 4
+ mkdir -p /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/m /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/out
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/clang -cc1 -internal-isystem /Users/buildbot/buildbot-root/aarch64-darwin/build/lib/clang/21/include -nostdsysteminc -x objective-c-header -emit-pch /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/Inputs/pch-used.h      -o /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/out/pch-used.h.pch -fmodules -fimplicit-module-maps      -fbuiltin-headers-in-system-modules -fmodules-cache-path=/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/cache -O0      -isystem /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/Inputs/System/usr/include # RUN: at line 6
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/clang -cc1 -internal-isystem /Users/buildbot/buildbot-root/aarch64-darwin/build/lib/clang/21/include -nostdsysteminc -x objective-c-header -emit-pch /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/Inputs/pch-used.h -o /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/out/pch-used.h.pch -fmodules -fimplicit-module-maps -fbuiltin-headers-in-system-modules -fmodules-cache-path=/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/cache -O0 -isystem /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/Inputs/System/usr/include
env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp TEMP=/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp TMP=/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp  not /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/clang /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/crash-vfs-include-pch.m -E -include-pch /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/out/pch-used.h.pch -fmodules -nostdlibinc      -fimplicit-module-maps -Xclang -fbuiltin-headers-in-system-modules      -fmodules-cache-path=/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/cache -O0 -Xclang -fno-validate-pch      -isystem /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/Inputs/System/usr/include -o /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/output.E 2>&1 | /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/crash-vfs-include-pch.m # RUN: at line 11
+ env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp TEMP=/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp TMP=/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp not /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/clang /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/crash-vfs-include-pch.m -E -include-pch /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/out/pch-used.h.pch -fmodules -nostdlibinc -fimplicit-module-maps -Xclang -fbuiltin-headers-in-system-modules -fmodules-cache-path=/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/cache -O0 -Xclang -fno-validate-pch -isystem /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/Inputs/System/usr/include -o /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/output.E
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/crash-vfs-include-pch.m
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck --check-prefix=CHECKSH /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/crash-vfs-include-pch.m -input-file /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/crash-vfs-*.sh # RUN: at line 17
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck --check-prefix=CHECKSH /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/crash-vfs-include-pch.m -input-file /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/crash-vfs-include-pch-c7e35e.sh
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck --check-prefix=CHECKYAML /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/crash-vfs-include-pch.m -input-file    /Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/crash-vfs-*.cache/vfs/vfs.yaml # RUN: at line 18
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck --check-prefix=CHECKYAML /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/clang/test/Modules/crash-vfs-include-pch.m -input-file '/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/crash-vfs-*.cache/vfs/vfs.yaml'
Could not open input file '/Users/buildbot/buildbot-root/aarch64-darwin/build/tools/clang/test/Modules/Output/crash-vfs-include-pch.m.tmp/crash-vfs-*.cache/vfs/vfs.yaml': No such file or directory

--

********************


@MaggieYingYi
Copy link
Contributor Author

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building clang at step 5 "compile-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/7030

It looks like this failure is not related with this PR. Build passed in the next build https://lab.llvm.org/buildbot/#/builders/10/builds/7031.

@MaggieYingYi
Copy link
Contributor Author

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-4 while building clang at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/21187

I am reproducing the failure in my local machine.

@MaggieYingYi
Copy link
Contributor Author

I can see the test Clang::crash-vfs-include-pch.m using -E when including a pch file. This PR applied the following change: if command is prepossess (-E), -include-pch is ignored. This caused the test failure. I think the -E needs to be removed in the command line. However, I cannot reproduce the error. The test is unsupported. I am still trying to reproduce the error locally.

MaggieYingYi added a commit that referenced this pull request Jun 10, 2025
@MaggieYingYi
Copy link
Contributor Author

Thanks @dyung for helping me verify the possible fixes. Unfortunately, the test would not pass by removing -E. Therefore, I had reverted the commit 4fb81f1.

MaggieYingYi added a commit to MaggieYingYi/llvm-project that referenced this pull request Jun 10, 2025
…-pch). (llvm#142409)"

Visual Studio has an argument to ignore all PCH related switches. clang-cl has also support option /Y-. Having the same option in clang would be helpful. This commit is to add support for ignoring PCH options (-ignore-pch).

The commit includes:
  1. Implement -ignore-pch as a Driver option.
  2. Add a Driver test and a PCH test.
  3. Add a section of -ignore-pch to user manual.
  4. Add a release note for the new option '-ignore-pch'.

Co-authored-by: Matheus Izvekov <[email protected]>
MaggieYingYi added a commit to MaggieYingYi/llvm-project that referenced this pull request Jun 11, 2025
…-pch). (llvm#142409)"

Visual Studio has an argument to ignore all PCH related switches. clang-cl has also support option /Y-. Having the same option in clang would be helpful. This commit is to add support for ignoring PCH options (-ignore-pch).

The commit includes:
  1. Implement -ignore-pch as a Driver option.
  2. Add a Driver test and a PCH test.
  3. Add a section of -ignore-pch to user manual.
  4. Add a release note for the new option '-ignore-pch'.

Co-authored-by: Matheus Izvekov <[email protected]>
@MaggieYingYi
Copy link
Contributor Author

I had created #143614 for code review in order to reload the patch.

rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
…lvm#142409)

Visual Studio has an argument to ignore all PCH related switches. clang-cl has also support option /Y-. Having the same option in clang would be helpful. This commit is to add support for ignoring PCH options (-ignore-pch).

The commit includes:
    1. Implement -ignore-pch as a Driver option.
    2. Add a Driver test and a PCH test.
    3. Add a section of -ignore-pch to user manual.
    4. Add a release note for the new option '-ignore-pch'.

Code reviewed by: Matheus Izvekov <[email protected]>
rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
…lvm#142409)

Visual Studio has an argument to ignore all PCH related switches. clang-cl has also support option /Y-. Having the same option in clang would be helpful. This commit is to add support for ignoring PCH options (-ignore-pch).

The commit includes:
    1. Implement -ignore-pch as a Driver option.
    2. Add a Driver test and a PCH test.
    3. Add a section of -ignore-pch to user manual.
    4. Add a release note for the new option '-ignore-pch'.

Code reviewed by: Matheus Izvekov <[email protected]>
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:PCH Precompiled headers clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants