llvm-project/clang/test/Driver/ignored-pch.cpp
Ying Yi 6f29837659
Reland: "[Frontend][PCH]-Add support for ignoring PCH options (-ignore-pch). (#142409)" (#143614)
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'.

The change since the original landing:
  1. preprocessing-only mode doesn't imply that -include-pch is disabled.

Co-authored-by: Matheus Izvekov <mizvekov@gmail.com>
2025-06-17 10:54:22 +01:00

20 lines
1015 B
C++

// RUN: rm -rf %t
// RUN: mkdir -p %t
// Create PCH without -ignore-pch.
// RUN: %clang -x c++-header %S/Inputs/pchfile.h -### 2>&1 | FileCheck %s -check-prefix=CHECK-EMIT-PCH
// RUN: %clang -x c++-header %S/Inputs/pchfile.h -o %t/pchfile.h.pch
// RUN: %clang %s -include-pch %t/pchfile.h.pch -### 2>&1 | FileCheck %s -check-prefix=CHECK-INCLUDE-PCH
// RUN: %clang %s -emit-ast -include-pch %t/pchfile.h.pch -### 2>&1 | FileCheck %s -check-prefixes=CHECK-EMIT-PCH,CHECK-INCLUDE-PCH
// Create PCH with -ignore-pch.
// RUN: %clang -x c++-header -ignore-pch %S/Inputs/pchfile.h -### 2>&1 | FileCheck %s -check-prefix=CHECK-IGNORE-PCH
// RUN: %clang %s -ignore-pch -include-pch %t/pchfile.h.pch -### 2>&1 | FileCheck %s -check-prefix=CHECK-IGNORE-PCH
// RUN: %clang %s -ignore-pch -emit-ast -include-pch %t/pchfile.h.pch -### 2>&1 | FileCheck %s -check-prefix=CHECK-IGNORE-PCH
// CHECK-EMIT-PCH: -emit-pch
// CHECK-INCLUDE-PCH: -include-pch
// CHECK-IGNORE-PCH-NOT: -emit-pch
// CHECK-IGNORE-PCH-NOT: -include-pch