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. |
| 10 | // RUN: rm %t.h || rm %t.h || rm %t.h |
Axel Naumann | 0433116 | 2011-01-27 10:55:51 +0000 | [diff] [blame] | 11 | |
| 12 | // Check diagnostic with location in original source: |
Matt Beaumont-Gay | daef9cc | 2011-02-01 22:44:06 +0000 | [diff] [blame] | 13 | // RUN: %clang_cc1 -include-pch %t.h.pch -Wpadded -emit-obj -o %t.o %s 2> %t.stderr |
Axel Naumann | 0433116 | 2011-01-27 10:55:51 +0000 | [diff] [blame] | 14 | // RUN: grep 'bytes to align' %t.stderr |
| 15 | |
| 16 | // Check diagnostic with 2nd location in original source: |
Matt Beaumont-Gay | daef9cc | 2011-02-01 22:44:06 +0000 | [diff] [blame] | 17 | // RUN: not %clang_cc1 -DREDECL -include-pch %t.h.pch -emit-obj -o %t.o %s 2> %t.stderr |
Axel Naumann | 0433116 | 2011-01-27 10:55:51 +0000 | [diff] [blame] | 18 | // RUN: grep 'previous definition is here' %t.stderr |
| 19 | |
| 20 | // Check diagnostic with instantiation location in original source: |
Matt Beaumont-Gay | daef9cc | 2011-02-01 22:44:06 +0000 | [diff] [blame] | 21 | // RUN: not %clang_cc1 -DINSTANTIATION -include-pch %t.h.pch -emit-obj -o %t.o %s 2> %t.stderr |
Axel Naumann | 0433116 | 2011-01-27 10:55:51 +0000 | [diff] [blame] | 22 | // RUN: grep 'cannot be used prior to' %t.stderr |
| 23 | |
| 24 | void qq(S*) {} |
| 25 | |
| 26 | #ifdef REDECL |
| 27 | float foo() {return 0f;} |
| 28 | #endif |
| 29 | |
| 30 | #ifdef INSTANTIATION |
| 31 | void f() { |
| 32 | tf<int>(); |
| 33 | } |
| 34 | #endif |