1 | // Test that the timestamp is not included in the produced pch file with |
2 | // -fno-pch-timestamp. |
3 | |
4 | // RUN: mkdir -p %t-dir |
5 | |
6 | // Copying files allow for read-only checkouts to run this test. |
7 | // RUN: cp %S/Inputs/pragma-once2-pch.h %t-dir |
8 | // RUN: cp %S/Inputs/pragma-once2.h %t-dir |
9 | // RUN: cp %s %t-dir/1.cpp |
10 | |
11 | // Check timestamp is included by default. |
12 | // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %t-dir/pragma-once2-pch.h |
13 | // RUN: touch -m -a -t 201008011501 %t-dir/pragma-once2.h |
14 | // RUN: not %clang_cc1 -include-pch %t %t-dir/1.cpp 2>&1 | FileCheck -check-prefix=CHECK-TIMESTAMP %s |
15 | |
16 | // Check bitcode output as well. |
17 | // RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-ON %s |
18 | |
19 | // Check timestamp inclusion is disabled by -fno-pch-timestamp. |
20 | // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %t-dir/pragma-once2-pch.h -fno-pch-timestamp |
21 | // RUN: touch -m -a -t 201008011502 %t-dir/pragma-once2.h |
22 | // RUN: %clang_cc1 -include-pch %t %t-dir/1.cpp 2>&1 |
23 | |
24 | // Check bitcode output as well. |
25 | // RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-OFF %s |
26 | |
27 | #include "pragma-once2.h" |
28 | |
29 | void g() { f(); } |
30 | |
31 | // CHECK-BITCODE-TIMESTAMP-ON: <INPUT_FILE abbrevid={{.*}} op0={{.*}} op1={{.*}} op2={{[^0]}} |
32 | // CHECK-BITCODE-TIMESTAMP-OFF: <INPUT_FILE abbrevid={{.*}} op0={{.*}} op1={{.*}} op2={{[0]}} |
33 | |
34 | // CHECK-TIMESTAMP: fatal error: file {{.*}} has been modified since the precompiled header {{.*}} was built |
35 | |