27 lines · cpp
1// Test reading of PCH without original input files.2 3// Generate the PCH, removing the original file:4// RUN: echo 'struct S{char c; int i; }; void foo() {}' > %t.h5// RUN: echo 'template <typename T> void tf() { T::foo(); }' >> %t.h6// RUN: %clang_cc1 -x c++ -emit-pch -o %t.h.pch %t.h7// RUN: rm %t.h8 9// Check diagnostic with location in original source:10// RUN: not %clang_cc1 -include-pch %t.h.pch -emit-obj -o %t.o %s 2> %t.stderr11// RUN: grep 'could not find file' %t.stderr12 13// Oftentimes on Windows there are open handles, and deletion will fail.14// REQUIRES: can-remove-opened-file15 16void qq(S*) {}17 18#ifdef REDECL19float foo() {return 0f;}20#endif21 22#ifdef INSTANTIATION23void f() {24 tf<int>();25}26#endif27