File: include-timestamp.cpp

package info (click to toggle)
llvm-toolchain-3.9 1%3A3.9.1-8
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 441,060 kB
  • ctags: 428,777
  • sloc: cpp: 2,546,577; ansic: 538,318; asm: 119,677; objc: 103,316; python: 102,148; sh: 27,847; pascal: 5,626; ml: 5,510; perl: 5,293; lisp: 4,801; makefile: 2,177; xml: 686; cs: 362; php: 212; csh: 117
file content (32 lines) | stat: -rw-r--r-- 1,381 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Test that the timestamp is not included in the produced pch file with
// -fno-pch-timestamp.

// Copying files allow for read-only checkouts to run this test.
// RUN: cp %S/Inputs/pragma-once2-pch.h %T
// RUN: cp %S/Inputs/pragma-once2.h %T
// RUN: cp %s %t1.cpp

// Check timestamp is included by default.
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %T/pragma-once2-pch.h
// RUN: touch -m -a -t 201008011501 %T/pragma-once2.h
// RUN: not %clang_cc1 -include-pch %t %t1.cpp 2>&1 | FileCheck -check-prefix=CHECK-TIMESTAMP %s

// Check bitcode output as well.
// RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-ON %s

// Check timestamp inclusion is disabled by -fno-pch-timestamp.
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %T/pragma-once2-pch.h -fno-pch-timestamp
// RUN: touch -m -a -t 201008011502 %T/pragma-once2.h
// RUN: %clang_cc1 -include-pch %t %t1.cpp 2>&1

// Check bitcode output as well.
// RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-OFF %s

#include "pragma-once2.h"

void g() { f(); }

// CHECK-BITCODE-TIMESTAMP-ON: <INPUT_FILE abbrevid={{.*}} op0={{.*}} op1={{.*}} op2={{[^0]}}
// CHECK-BITCODE-TIMESTAMP-OFF: <INPUT_FILE abbrevid={{.*}} op0={{.*}} op1={{.*}} op2={{[0]}}

// CHECK-TIMESTAMP: fatal error: file {{.*}} has been modified since the precompiled header {{.*}} was built