Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Driver / pch-codegen.cpp
blobac4ffb978ca59b1c7bd5a2eb3d6063354a1dedce
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
4 // Create PCH without codegen.
5 // RUN: %clang -x c++-header %S/../Modules/Inputs/codegen-flags/foo.h -### 2>&1 | FileCheck %s -check-prefix=CHECK-PCH-CREATE
6 // CHECK-PCH-CREATE: -emit-pch
7 // CHECK-PCH-CREATE-NOT: -fmodules-codegen
8 // CHECK-PCH-CREATE-NOT: -fmodules-debuginfo
9 /// Also test that the default extension name is .pch instead of .gch
10 // CHECK-PCH-CREATE: "-o" "{{[^"]+.pch}}"
12 // Create PCH with -fpch-codegen.
13 // RUN: %clang -x c++-header -fpch-codegen %S/../Modules/Inputs/codegen-flags/foo.h -o %t/foo-cg.pch -### 2>&1 | FileCheck %s -check-prefix=CHECK-PCH-CODEGEN-CREATE
14 // CHECK-PCH-CODEGEN-CREATE: -emit-pch
15 // CHECK-PCH-CODEGEN-CREATE: -fmodules-codegen
16 // CHECK-PCH-CODEGEN-CREATE: "-x" "c++-header"
17 // CHECK-PCH-CODEGEN-CREATE-NOT: -fmodules-debuginfo
19 // Create PCH with -fpch-debuginfo.
20 // RUN: %clang -x c++-header -fpch-debuginfo %S/../Modules/Inputs/codegen-flags/foo.h -g -o %t/foo-di.pch -### 2>&1 | FileCheck %s -check-prefix=CHECK-PCH-DEBUGINFO-CREATE
21 // CHECK-PCH-DEBUGINFO-CREATE: -emit-pch
22 // CHECK-PCH-DEBUGINFO-CREATE: -fmodules-debuginfo
23 // CHECK-PCH-DEBUGINFO-CREATE: "-x" "c++-header"
24 // CHECK-PCH-DEBUGINFO-CREATE-NOT: -fmodules-codegen
26 // Create PCH's object file for -fpch-codegen.
27 // RUN: touch %t/foo-cg.pch
28 // RUN: %clang -c -fintegrated-as %t/foo-cg.pch -o %t/foo-cg.o -### 2>&1 | FileCheck %s -check-prefix=CHECK-PCH-CODEGEN-OBJ
29 // CHECK-PCH-CODEGEN-OBJ: -emit-obj
30 // CHECK-PCH-CODEGEN-OBJ: "-main-file-name" "foo-cg.pch"
31 // CHECK-PCH-CODEGEN-OBJ: "-o" "{{.*}}foo-cg.o"
32 // CHECK-PCH-CODEGEN-OBJ: "-x" "precompiled-header"
34 // Create PCH's object file for -fpch-debuginfo.
35 // RUN: touch %t/foo-di.pch
36 // RUN: %clang -c -fintegrated-as %t/foo-di.pch -g -o %t/foo-di.o -### 2>&1 | FileCheck %s -check-prefix=CHECK-PCH-DEBUGINFO-OBJ
37 // CHECK-PCH-DEBUGINFO-OBJ: -emit-obj
38 // CHECK-PCH-DEBUGINFO-OBJ: "-main-file-name" "foo-di.pch"
39 // CHECK-PCH-DEBUGINFO-OBJ: "-o" "{{.*}}foo-di.o"
40 // CHECK-PCH-DEBUGINFO-OBJ: "-x" "precompiled-header"