1 | // First trial: pass -DIGNORED=1 to both. This should obviously work. |
2 | // RUN: rm -rf %t.modules |
3 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify |
4 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch %s -verify |
5 | |
6 | // Second trial: pass -DIGNORED=1 only to the second invocation. We |
7 | // should detect the failure. |
8 | // |
9 | // RUN: rm -rf %t.modules |
10 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify |
11 | // RUN: not %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch %s > %t.err 2>&1 |
12 | // RUN: FileCheck -check-prefix=CHECK-CONFLICT %s < %t.err |
13 | // CHECK-CONFLICT: PCH was compiled with module cache path |
14 | |
15 | // Third trial: pass -DIGNORED=1 only to the second invocation, but |
16 | // make it ignored. There should be no failure, IGNORED is defined in |
17 | // the translation unit but not the module. |
18 | // RUN: rm -rf %t.modules |
19 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify |
20 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED %s -verify |
21 | |
22 | // Fourth trial: pass -DIGNORED=1 and -fmodules-ignore-macro=IGNORED |
23 | // to both invocations, so modules will be built without the IGNORED |
24 | // macro. |
25 | // RUN: rm -rf %t.modules |
26 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules-ignore-macro=IGNORED -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify |
27 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED -DNO_IGNORED_ANYWHERE -fmodules-ignore-macro=NO_IGNORED_ANYWHERE %s -verify |
28 | |
29 | // Fifth trial: pass -DIGNORED=1 and -fmodules-ignore-macro=IGNORED=1 |
30 | // to both invocations, so modules will be built without the IGNORED |
31 | // macro. |
32 | // RUN: rm -rf %t.modules |
33 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules-ignore-macro=IGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify |
34 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED=1 -DNO_IGNORED_ANYWHERE -fmodules-ignore-macro=NO_IGNORED_ANYWHERE %s -verify |
35 | |
36 | // expected-no-diagnostics |
37 | |
38 | #ifndef HEADER |
39 | #define HEADER |
40 | @import ignored_macros; |
41 | #endif |
42 | |
43 | @import ignored_macros; |
44 | |
45 | struct Point p; |
46 | |
47 | #ifdef NO_IGNORED_ANYWHERE |
48 | void *has_ignored(int, int, int); |
49 | #endif |
50 | |