| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
// RUN: cd %t |
| 4 |
|
| 5 |
// This test builds two PCHs. bridging.h.pch depends on h1.h.pch. |
| 6 |
// Then the test uses bridiging.h.pch in a source file that imports |
| 7 |
// a module with config macros. |
| 8 |
// This is a normal use case and no warnings should be issued. |
| 9 |
// RUN: %clang_cc1 -fmodules \ |
| 10 |
// RUN: -fmodule-map-file=%S/Inputs/pch-config-macros/include/module.modulemap \ |
| 11 |
// RUN: -fmodules-cache-path=%t/cache -I %S/Inputs/pch-config-macros/include \ |
| 12 |
// RUN: h1.h -emit-pch -o h1.h.pch -DCONFIG1 -DCONFIG2 |
| 13 |
// RUN: %clang_cc1 -fmodules \ |
| 14 |
// RUN: -fmodule-map-file=%S/Inputs/pch-config-macros/include/module.modulemap \ |
| 15 |
// RUN: -fmodules-cache-path=%t/cache -I %S/Inputs/pch-config-macros/include \ |
| 16 |
// RUN: -include-pch h1.h.pch bridging.h -emit-pch -o bridging.h.pch \ |
| 17 |
// RUN: -DCONFIG1 -DCONFIG2 |
| 18 |
// RUN: %clang_cc1 -fmodules \ |
| 19 |
// RUN: -fmodule-map-file=%S/Inputs/pch-config-macros/include/module.modulemap \ |
| 20 |
// RUN: -fmodules-cache-path=%t/cache -I %S/Inputs/pch-config-macros/include \ |
| 21 |
// RUN: -emit-obj -o main.o main.c -include-pch bridging.h.pch \ |
| 22 |
// RUN: -DCONFIG1 -DCONFIG2 -verify |
| 23 |
|
| 24 |
//--- h1.h |
| 25 |
#if CONFIG1 |
| 26 |
int bar1() { return 42; } |
| 27 |
#else |
| 28 |
int bar2() { return 43; } |
| 29 |
#endif |
| 30 |
|
| 31 |
//--- bridging.h |
| 32 |
#if CONFIG1 |
| 33 |
int bar() { return bar1(); } |
| 34 |
#else |
| 35 |
int bar() { return bar2(); } |
| 36 |
#endif |
| 37 |
|
| 38 |
#if CONFIG2 |
| 39 |
int baz() { return 77; } |
| 40 |
#endif |
| 41 |
|
| 42 |
//--- main.c |
| 43 |
#include "Mod1.h" |
| 44 |
// expected-no-diagnostics |
| 45 |
|
| 46 |
int main_func() { |
| 47 |
return foo() + bar(); |
| 48 |
} |