Home | History | Annotate | Download | only in PCH
      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
      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:
     10 // RUN: %clang_cc1 -include-pch %t.h.pch -Wpadded -emit-obj -o %t.o %s 2> %t.stderr
     11 // RUN: grep 'bytes to align' %t.stderr
     12 
     13 // Check diagnostic with 2nd location in original source:
     14 // RUN: not %clang_cc1 -DREDECL -include-pch %t.h.pch -emit-obj -o %t.o %s 2> %t.stderr
     15 // RUN: grep 'previous definition is here' %t.stderr
     16 
     17 // Check diagnostic with instantiation location in original source:
     18 // RUN: not %clang_cc1 -DINSTANTIATION -include-pch %t.h.pch -emit-obj -o %t.o %s 2> %t.stderr
     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
     32