blob: d7d0fab13ac53f8cb2a05dc4eb2241a3d87add53 [file] [log] [blame]
Pierre Gousseau533a8932016-07-13 14:21:11 +00001// Test that the timestamp is not included in the produced pch file with
2// -fno-pch-timestamp.
3
Pierre Gousseaue3014fc2016-07-14 13:58:27 +00004// 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 Gousseau533a8932016-07-13 14:21:11 +00009// Check timestamp is included by default.
Pierre Gousseaue3014fc2016-07-14 13:58:27 +000010// 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 Gousseau533a8932016-07-13 14:21:11 +000013
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 Gousseaue3014fc2016-07-14 13:58:27 +000018// 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 Gousseau533a8932016-07-13 14:21:11 +000021
22// Check bitcode output as well.
23// RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-OFF %s
24
Pierre Gousseaue3014fc2016-07-14 13:58:27 +000025#include "pragma-once2.h"
Pierre Gousseau533a8932016-07-13 14:21:11 +000026
27void 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