41 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir -p %t3 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-CREATE6// CHECK-PCH-CREATE: -emit-pch7// CHECK-PCH-CREATE-NOT: -fmodules-codegen8// CHECK-PCH-CREATE-NOT: -fmodules-debuginfo9/// Also test that the default extension name is .pch instead of .gch10// CHECK-PCH-CREATE: "-o" "{{[^"]+.pch}}"11 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-CREATE14// CHECK-PCH-CODEGEN-CREATE: -emit-pch15// CHECK-PCH-CODEGEN-CREATE: -fmodules-codegen16// CHECK-PCH-CODEGEN-CREATE: "-x" "c++-header"17// CHECK-PCH-CODEGEN-CREATE-NOT: -fmodules-debuginfo18 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-CREATE21// CHECK-PCH-DEBUGINFO-CREATE: -emit-pch22// CHECK-PCH-DEBUGINFO-CREATE: -fmodules-debuginfo23// CHECK-PCH-DEBUGINFO-CREATE: "-x" "c++-header"24// CHECK-PCH-DEBUGINFO-CREATE-NOT: -fmodules-codegen25 26// Create PCH's object file for -fpch-codegen.27// RUN: touch %t/foo-cg.pch28// RUN: %clang -c -fintegrated-as %t/foo-cg.pch -o %t/foo-cg.o -### 2>&1 | FileCheck %s -check-prefix=CHECK-PCH-CODEGEN-OBJ29// CHECK-PCH-CODEGEN-OBJ: -emit-obj30// 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"33 34// Create PCH's object file for -fpch-debuginfo.35// RUN: touch %t/foo-di.pch36// RUN: %clang -c -fintegrated-as %t/foo-di.pch -g -o %t/foo-di.o -### 2>&1 | FileCheck %s -check-prefix=CHECK-PCH-DEBUGINFO-OBJ37// CHECK-PCH-DEBUGINFO-OBJ: -emit-obj38// 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"41