1// Test reading of PCH with changed location of original input files, 2// i.e. invoking header search. 3// REQUIRES: shell 4 5// Generate the original files: 6// RUN: rm -rf %t_orig %t_moved 7// RUN: mkdir -p %t_orig/sub %t_orig/sub2 8// RUN: echo 'struct orig_sub{char c; int i; };' > %t_orig/sub/orig_sub.h 9// RUN: echo 'void orig_sub2_1();' > %t_orig/sub2/orig_sub2_1.h 10// RUN: echo '#include "orig_sub2_1.h"' > %t_orig/sub2/orig_sub2.h 11// RUN: echo 'template <typename T> void tf() { orig_sub2_1(); T::foo(); }' >> %t_orig/sub2/orig_sub2.h 12// RUN: echo 'void foo() {}' > %t_orig/tmp2.h 13// RUN: echo '#include "tmp2.h"' > %t_orig/all.h 14// RUN: echo '#include "sub/orig_sub.h"' >> %t_orig/all.h 15// RUN: echo '#include "orig_sub2.h"' >> %t_orig/all.h 16// RUN: echo 'int all();' >> %t_orig/all.h 17 18// Generate the PCH: 19// RUN: cd %t_orig && %clang_cc1 -x c++ -emit-pch -o all.h.pch -Isub2 all.h 20// RUN: cp -pR %t_orig %t_moved 21 22// Check diagnostic with location in original source: 23// RUN: %clang_cc1 -include-pch all.h.pch -I%t_moved -I%t_moved/sub2 -Wpadded -emit-obj -o %t.o %s 2> %t.stderr 24// RUN: grep 'struct orig_sub' %t.stderr 25 26// Check diagnostic with 2nd location in original source: 27// RUN: not %clang_cc1 -DREDECL -include-pch all.h.pch -I%t_moved -I%t_moved/sub2 -emit-obj -o %t.o %s 2> %t.stderr 28// RUN: grep 'void foo' %t.stderr 29 30// Check diagnostic with instantiation location in original source: 31// RUN: not %clang_cc1 -DINSTANTIATION -include-pch all.h.pch -I%t_moved -I%t_moved/sub2 -emit-obj -o %t.o %s 2> %t.stderr 32// RUN: grep 'orig_sub2_1' %t.stderr 33 34void qq(orig_sub*) {all();} 35 36#ifdef REDECL 37float foo() {return 0;} 38#endif 39 40#ifdef INSTANTIATION 41void f() { 42 tf<int>(); 43} 44#endif 45