1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 
4 // Create PCH without codegen.
5 // RUN: %clang -x c++-header %S/../Modules/Inputs/codegen-flags/foo.h -o %t/foo-cg.pch -### 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 
10 // Create PCH with -fpch-codegen.
11 // 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
12 // CHECK-PCH-CODEGEN-CREATE: -emit-pch
13 // CHECK-PCH-CODEGEN-CREATE: -fmodules-codegen
14 // CHECK-PCH-CODEGEN-CREATE: "-x" "c++-header"
15 // CHECK-PCH-CODEGEN-CREATE-NOT: -fmodules-debuginfo
16 
17 // Create PCH with -fpch-debuginfo.
18 // 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
19 // CHECK-PCH-DEBUGINFO-CREATE: -emit-pch
20 // CHECK-PCH-DEBUGINFO-CREATE: -fmodules-debuginfo
21 // CHECK-PCH-DEBUGINFO-CREATE: "-x" "c++-header"
22 // CHECK-PCH-DEBUGINFO-CREATE-NOT: -fmodules-codegen
23 
24 // Create PCH's object file for -fpch-codegen.
25 // RUN: touch %t/foo-cg.pch
26 // RUN: %clang -c -fintegrated-as %t/foo-cg.pch -o %t/foo-cg.o -### 2>&1 | FileCheck %s -check-prefix=CHECK-PCH-CODEGEN-OBJ
27 // CHECK-PCH-CODEGEN-OBJ: -emit-obj
28 // CHECK-PCH-CODEGEN-OBJ: "-main-file-name" "foo-cg.pch"
29 // CHECK-PCH-CODEGEN-OBJ: "-o" "{{.*}}foo-cg.o"
30 // CHECK-PCH-CODEGEN-OBJ: "-x" "precompiled-header"
31 
32 // Create PCH's object file for -fpch-debuginfo.
33 // RUN: touch %t/foo-di.pch
34 // 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
35 // CHECK-PCH-DEBUGINFO-OBJ: -emit-obj
36 // CHECK-PCH-DEBUGINFO-OBJ: "-main-file-name" "foo-di.pch"
37 // CHECK-PCH-DEBUGINFO-OBJ: "-o" "{{.*}}foo-di.o"
38 // CHECK-PCH-DEBUGINFO-OBJ: "-x" "precompiled-header"
39