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.h
5 // RUN: echo 'template <typename T> void tf() { T::foo(); }' >> %t.h
6 // RUN: %clang_cc1 -x c++ -emit-pch -o %t.h.pch %t.h
7 // RUN: rm %t.h
8
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.stderr
11 // RUN: grep 'could not find file' %t.stderr
12
13 // Oftentimes on Windows there are open handles, and deletion will fail.
14 // REQUIRES: can-remove-opened-file
15
qq(S *)16 void qq(S*) {}
17
18 #ifdef REDECL
foo()19 float foo() {return 0f;}
20 #endif
21
22 #ifdef INSTANTIATION
f()23 void f() {
24 tf<int>();
25 }
26 #endif
27