[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / PCH / missing-file.cpp
blob8bdb08d6373de153451e1d8db77f9c26ab31f7f9
1 // Test reading of PCH without original input files.
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
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
13 // Oftentimes on Windows there are open handles, and deletion will fail.
14 // REQUIRES: can-remove-opened-file
16 void qq(S*) {}
18 #ifdef REDECL
19 float foo() {return 0f;}
20 #endif
22 #ifdef INSTANTIATION
23 void f() {
24 tf<int>();
26 #endif