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