missing-file.cpp 801 B

123456789101112131415161718192021222324252627
  1. // Test reading of PCH without original input files.
  2. // Generate the PCH, removing the original file:
  3. // RUN: echo 'struct S{char c; int i; }; void foo() {}' > %t.h
  4. // RUN: echo 'template <typename T> void tf() { T::foo(); }' >> %t.h
  5. // RUN: %clang_cc1 -x c++ -emit-pch -o %t.h.pch %t.h
  6. // %t.h might be touched by scanners as a hot file on Windows,
  7. // to fail to remove %.h with single run.
  8. // FIXME: Do we really want to work around bugs in virus checkers here?
  9. // RUN: rm %t.h || rm %t.h || rm %t.h
  10. // Check diagnostic with location in original source:
  11. // RUN: not %clang_cc1 -include-pch %t.h.pch -emit-obj -o %t.o %s 2> %t.stderr
  12. // RUN: grep 'could not find file' %t.stderr
  13. void qq(S*) {}
  14. #ifdef REDECL
  15. float foo() {return 0f;}
  16. #endif
  17. #ifdef INSTANTIATION
  18. void f() {
  19. tf<int>();
  20. }
  21. #endif