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 | |
| 4 | // Check timestamp is included by default. |
| 5 | // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/Inputs/pragma-once2-pch.h |
| 6 | // RUN: touch -m -a -t 201008011501 %S/Inputs/pragma-once2.h |
| 7 | // RUN: not %clang_cc1 -include-pch %t %s 2>&1 | FileCheck -check-prefix=CHECK-TIMESTAMP %s |
| 8 | |
| 9 | // Check bitcode output as well. |
| 10 | // RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-ON %s |
| 11 | |
| 12 | // Check timestamp inclusion is disabled by -fno-pch-timestamp. |
| 13 | // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/Inputs/pragma-once2-pch.h -fno-pch-timestamp |
| 14 | // RUN: touch -m -a -t 201008011502 %S/Inputs/pragma-once2.h |
| 15 | // RUN: %clang_cc1 -include-pch %t %s 2>&1 |
| 16 | |
| 17 | // Check bitcode output as well. |
| 18 | // RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-OFF %s |
| 19 | |
| 20 | #include "Inputs/pragma-once2.h" |
| 21 | |
| 22 | void g() { f(); } |
| 23 | |
| 24 | // CHECK-BITCODE-TIMESTAMP-ON: <INPUT_FILE abbrevid={{.*}} op0={{.*}} op1={{.*}} op2={{[^0]}} |
| 25 | // CHECK-BITCODE-TIMESTAMP-OFF: <INPUT_FILE abbrevid={{.*}} op0={{.*}} op1={{.*}} op2={{[0]}} |
| 26 | |
| 27 | // CHECK-TIMESTAMP: fatal error: file {{.*}} has been modified since the precompiled header {{.*}} was built |