1533a893fSPierre Gousseau // Test that the timestamp is not included in the produced pch file with 2533a893fSPierre Gousseau // -fno-pch-timestamp. 3533a893fSPierre Gousseau 45b57633aSKuba Mracek // RUN: mkdir -p %t-dir 55b57633aSKuba Mracek 6e3014fc1SPierre Gousseau // Copying files allow for read-only checkouts to run this test. 75b57633aSKuba Mracek // RUN: cp %S/Inputs/pragma-once2-pch.h %t-dir 85b57633aSKuba Mracek // RUN: cp %S/Inputs/pragma-once2.h %t-dir 95b57633aSKuba Mracek // RUN: cp %s %t-dir/1.cpp 10e3014fc1SPierre Gousseau 11533a893fSPierre Gousseau // Check timestamp is included by default. 125b57633aSKuba Mracek // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %t-dir/pragma-once2-pch.h 135b57633aSKuba Mracek // RUN: touch -m -a -t 201008011501 %t-dir/pragma-once2.h 145b57633aSKuba Mracek // RUN: not %clang_cc1 -include-pch %t %t-dir/1.cpp 2>&1 | FileCheck -check-prefix=CHECK-TIMESTAMP %s 15533a893fSPierre Gousseau 16533a893fSPierre Gousseau // Check bitcode output as well. 17533a893fSPierre Gousseau // RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-ON %s 18533a893fSPierre Gousseau 19533a893fSPierre Gousseau // Check timestamp inclusion is disabled by -fno-pch-timestamp. 205b57633aSKuba Mracek // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %t-dir/pragma-once2-pch.h -fno-pch-timestamp 215b57633aSKuba Mracek // RUN: touch -m -a -t 201008011502 %t-dir/pragma-once2.h 225b57633aSKuba Mracek // RUN: %clang_cc1 -include-pch %t %t-dir/1.cpp 2>&1 23533a893fSPierre Gousseau 24533a893fSPierre Gousseau // Check bitcode output as well. 25533a893fSPierre Gousseau // RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-OFF %s 26533a893fSPierre Gousseau 27e3014fc1SPierre Gousseau #include "pragma-once2.h" 28533a893fSPierre Gousseau g()29533a893fSPierre Gousseauvoid g() { f(); } 30533a893fSPierre Gousseau 31533a893fSPierre Gousseau // CHECK-BITCODE-TIMESTAMP-ON: <INPUT_FILE abbrevid={{.*}} op0={{.*}} op1={{.*}} op2={{[^0]}} 32533a893fSPierre Gousseau // CHECK-BITCODE-TIMESTAMP-OFF: <INPUT_FILE abbrevid={{.*}} op0={{.*}} op1={{.*}} op2={{[0]}} 33533a893fSPierre Gousseau 34*df7b6b91SRichard Smith // CHECK-TIMESTAMP: fatal error: file {{.*}} has been modified since the precompiled header {{.*}} was built: mtime changed (was {{.*}}, now {{.*}}) 35