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