|
| 1 | +// RUN: rm -rf %t.pch %t.ll |
| 2 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -o %t.pch |
| 3 | +// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -o %t.ll |
| 4 | +// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s |
| 5 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 6 | + |
| 7 | +// Check that -ignore-pch causes -emit-pch and -include-pch options to be ignored. |
| 8 | +// RUN: rm -rf %t.pch %t.ll |
| 9 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -ignore-pch -emit-pch -o %t.pch |
| 10 | +// RUN: %clang_cc1 %s -include-pch %t.pch -ignore-pch -emit-llvm -o %t.ll |
| 11 | +// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s |
| 12 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 13 | + |
| 14 | +// Check that -ignore-pch is passed through Driver. |
| 15 | +// RUN: rm -rf %t.pch %t.ll |
| 16 | +// RUN: %clang -x c-header %S/Inputs/ignored-pch.h -Xclang -emit-pch -o %t.pch |
| 17 | +// RUN: %clang -S %s -include-pch %t.pch -Xclang -emit-llvm -o %t.ll |
| 18 | +// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s |
| 19 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 20 | + |
| 21 | +// RUN: rm -rf %t.pch %t.ll |
| 22 | +// RUN: %clang -x c-header %S/Inputs/ignored-pch.h -Xclang -ignore-pch -Xclang -emit-pch -o %t.pch |
| 23 | +// RUN: %clang -S %s -include-pch %t.pch -Xclang -ignore-pch -Xclang -emit-llvm -o %t.ll |
| 24 | +// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s |
| 25 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 26 | + |
| 27 | +// Check that -ignore-pch works for multiple PCH related options. |
| 28 | +// Test with -building-pch-with-obj. |
| 29 | +// RUN: rm -rf %t.pch %t.ll |
| 30 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -ignore-pch -emit-pch -building-pch-with-obj -o %t.pch |
| 31 | +// RUN: %clang_cc1 %s -include-pch %t.pch -ignore-pch -emit-llvm -building-pch-with-obj -o %t.ll |
| 32 | +// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s |
| 33 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 34 | + |
| 35 | +// Test with -fallow-pch-with-compiler-errors. |
| 36 | +// RUN: rm -rf %t.pch %t.ll |
| 37 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -ignore-pch -emit-pch -fallow-pch-with-compiler-errors -o %t.pch |
| 38 | +// RUN: %clang_cc1 %s -include-pch %t.pch -ignore-pch -emit-llvm -fallow-pch-with-compiler-errors -o %t.ll |
| 39 | +// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s |
| 40 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 41 | + |
| 42 | +// Test with -fallow-pch-with-different-modules-cache-path. |
| 43 | +// RUN: rm -rf %t.pch %t.ll |
| 44 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fallow-pch-with-different-modules-cache-path -o %t.pch |
| 45 | +// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fallow-pch-with-different-modules-cache-path -o %t.ll |
| 46 | +// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s |
| 47 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 48 | + |
| 49 | +// Test with -fpch-codegen. |
| 50 | +// RUN: rm -rf %t.pch %t.ll |
| 51 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fpch-codegen -o %t.pch |
| 52 | +// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fpch-codegen -o %t.ll |
| 53 | +// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s |
| 54 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 55 | + |
| 56 | +// Test with -fpch-debuginfo. |
| 57 | +// RUN: rm -rf %t.pch %t.ll |
| 58 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fpch-debuginfo -o %t.pch |
| 59 | +// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fpch-debuginfo -o %t.ll |
| 60 | +// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s |
| 61 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 62 | + |
| 63 | +// Test with -fpch-instantiate-templates. |
| 64 | +// RUN: rm -rf %t.pch %t.ll |
| 65 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fpch-instantiate-templates -o %t.pch |
| 66 | +// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fpch-instantiate-templates -o %t.ll |
| 67 | +// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s |
| 68 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 69 | + |
| 70 | +// Test with -fno-pch-timestamp. |
| 71 | +// RUN: rm -rf %t.pch %t.ll |
| 72 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fno-pch-timestamp -o %t.pch |
| 73 | +// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fno-pch-timestamp -o %t.ll |
| 74 | +// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s |
| 75 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 76 | + |
| 77 | +// Test with -fno-validate-pch. |
| 78 | +// RUN: rm -rf %t.pch %t.ll |
| 79 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -fno-validate-pch -o %t.pch |
| 80 | +// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -fno-validate-pch -o %t.ll |
| 81 | +// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s |
| 82 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 83 | + |
| 84 | +// Test with -relocatable-pch. |
| 85 | +// RUN: rm -rf %t.pch %t.ll |
| 86 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -relocatable-pch -o %t.pch |
| 87 | +// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -relocatable-pch -o %t.ll |
| 88 | +// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s |
| 89 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 90 | + |
| 91 | +// Test with -pch-through-hdrstop-create/-pch-through-hdrstop-use |
| 92 | +// RUN: rm -rf %t.pch %t.ll |
| 93 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -pch-through-hdrstop-create -o %t.pch |
| 94 | +// RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -pch-through-hdrstop-use -o %t.ll |
| 95 | +// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s |
| 96 | +// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s |
| 97 | + |
| 98 | +// Test with AST dump output: |
| 99 | +// RUN: rm -rf %t.pch %t.ll |
| 100 | +// RUN: %clang_cc1 -x c-header %S/Inputs/ignored-pch.h -emit-pch -o %t.pch |
| 101 | +// RUN: %clang_cc1 %s -include-pch %t.pch -ast-dump-all | FileCheck --check-prefix=CHECK-AST-PCH %s |
| 102 | +// RUN: %clang_cc1 %s -include-pch %t.pch -ignore-pch -ast-dump-all | FileCheck --check-prefix=CHECK-AST %s |
| 103 | + |
| 104 | +// CHECK-PCH: ignored-pch.c.{{.*}}.pch |
| 105 | +// CHECK-OBJ: ignored-pch.c.{{.*}}.ll |
| 106 | +// CHECK-ERROR: ignored-pch.c.{{.*}}.pch{{'?}}: No such file or directory |
| 107 | +// CHECK-AST-PCH: <undeserialized declarations> |
| 108 | +// CHECK-AST-NOT: <undeserialized declarations> |
| 109 | + |
| 110 | +#include "Inputs/ignored-pch.h" |
| 111 | +#pragma hdrstop |
| 112 | +int main() { |
| 113 | + return f(); |
| 114 | +} |
0 commit comments