Axel Naumann | 0433116 | 2011-01-27 10:55:51 +0000 | [diff] [blame] | 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 |
Axel Naumann | 0433116 | 2011-01-27 10:55:51 +0000 | [diff] [blame] | 6 | // RUN: %clang_cc1 -x c++ -emit-pch -o %t.h.pch %t.h |
NAKAMURA Takumi | 4d59422 | 2012-09-12 10:38:08 +0000 | [diff] [blame] | 7 | |
| 8 | // %t.h might be touched by scanners as a hot file on Windows, |
| 9 | // to fail to remove %.h with single run. |
Richard Smith | 9867eba | 2012-12-05 22:33:14 +0000 | [diff] [blame] | 10 | // FIXME: Do we really want to work around bugs in virus checkers here? |
Richard Smith | 95d8255 | 2012-12-05 22:59:28 +0000 | [diff] [blame] | 11 | // RUN: rm %t.h || rm %t.h || rm %t.h |
Axel Naumann | 0433116 | 2011-01-27 10:55:51 +0000 | [diff] [blame] | 12 | |
| 13 | // Check diagnostic with location in original source: |
Douglas Gregor | 745e6f1 | 2012-10-19 00:38:02 +0000 | [diff] [blame] | 14 | // RUN: not %clang_cc1 -include-pch %t.h.pch -emit-obj -o %t.o %s 2> %t.stderr |
| 15 | // RUN: grep 'could not find file' %t.stderr |
Axel Naumann | 0433116 | 2011-01-27 10:55:51 +0000 | [diff] [blame] | 16 | |
| 17 | void qq(S*) {} |
| 18 | |
| 19 | #ifdef REDECL |
| 20 | float foo() {return 0f;} |
| 21 | #endif |
| 22 | |
| 23 | #ifdef INSTANTIATION |
| 24 | void f() { |
| 25 | tf<int>(); |
| 26 | } |
| 27 | #endif |