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