blob: 7dd11d4561a8e7fd112997b7f8d6c2687b3e16d6 [file] [log] [blame]
Axel Naumann04331162011-01-27 10:55:51 +00001// 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 Naumann04331162011-01-27 10:55:51 +00006// RUN: %clang_cc1 -x c++ -emit-pch -o %t.h.pch %t.h
NAKAMURA Takumi4d594222012-09-12 10:38:08 +00007
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 Naumann04331162011-01-27 10:55:51 +000011
12// Check diagnostic with location in original source:
Douglas Gregor745e6f12012-10-19 00:38:02 +000013// RUN: not %clang_cc1 -include-pch %t.h.pch -emit-obj -o %t.o %s 2> %t.stderr
14// RUN: grep 'could not find file' %t.stderr
Axel Naumann04331162011-01-27 10:55:51 +000015
16void qq(S*) {}
17
18#ifdef REDECL
19float foo() {return 0f;}
20#endif
21
22#ifdef INSTANTIATION
23void f() {
24 tf<int>();
25}
26#endif