• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Test that the timestamp is not included in the produced pch file with
2 // -fno-pch-timestamp.
3 
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 
9 // Check timestamp is included by default.
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
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.
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
21 
22 // Check bitcode output as well.
23 // RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-OFF %s
24 
25 #include "pragma-once2.h"
26 
g()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
33