xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/pch-dir.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1 // RUN: mkdir -p %t.h.gch
2 // RUN: %clang -x c-header %S/pch-dir.h -DFOO=foo -o %t.h.gch/c.gch
3 // RUN: %clang -x c-header %S/pch-dir.h -DFOO=bar -o %t.h.gch/cbar.gch
4 // RUN: %clang -x c++-header -std=c++98 %S/pch-dir.h -o %t.h.gch/cpp.gch
5 // RUN: %clang -include %t.h -DFOO=foo -fsyntax-only %s -Xclang -print-stats 2> %t.clog
6 // RUN: FileCheck -check-prefix=CHECK-C %s < %t.clog
7 // RUN: %clang -include %t.h -DFOO=bar -DBAR=bar -fsyntax-only %s -Xclang -ast-print > %t.cbarlog
8 // RUN: FileCheck -check-prefix=CHECK-CBAR %s < %t.cbarlog
9 // RUN: %clang -x c++ -include %t.h -std=c++98 -fsyntax-only %s -Xclang -print-stats 2> %t.cpplog
10 // RUN: FileCheck -check-prefix=CHECK-CPP %s < %t.cpplog
11 
12 // RUN: not %clang -x c++ -std=c++11 -include %t.h -fsyntax-only %s 2> %t.cpp11log
13 // RUN: FileCheck -check-prefix=CHECK-CPP11 %s < %t.cpp11log
14 
15 // CHECK-CBAR: int bar
16 int FOO;
17 
get()18 int get() {
19 #ifdef __cplusplus
20   // CHECK-CPP: .h.gch{{[/\\]}}cpp.gch
21   return i;
22 #else
23   // CHECK-C: .h.gch{{[/\\]}}c.gch
24   return j;
25 #endif
26 }
27 
28 // CHECK-CPP11: no suitable precompiled header file found in directory
29