Douglas Gregor | 2a06085 | 2013-02-07 00:21:12 +0000 | [diff] [blame] | 1 | // First trial: pass -DIGNORED=1 to both. This should obviously work. |
Douglas Gregor | 8bf778e | 2013-02-06 22:40:31 +0000 | [diff] [blame] | 2 | // RUN: rm -rf %t.modules |
Douglas Gregor | 953a61f | 2013-02-07 19:01:24 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -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 -I %S/Inputs -include-pch %t.pch %s -verify |
Douglas Gregor | 8bf778e | 2013-02-06 22:40:31 +0000 | [diff] [blame] | 5 | |
Douglas Gregor | 2a06085 | 2013-02-07 00:21:12 +0000 | [diff] [blame] | 6 | // Second trial: pass -DIGNORED=1 only to the second invocation. We |
| 7 | // should detect the failure. |
| 8 | // |
Douglas Gregor | 8bf778e | 2013-02-06 22:40:31 +0000 | [diff] [blame] | 9 | // RUN: rm -rf %t.modules |
Douglas Gregor | 953a61f | 2013-02-07 19:01:24 +0000 | [diff] [blame] | 10 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -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 -I %S/Inputs -include-pch %t.pch %s > %t.err 2>&1 |
Douglas Gregor | 8bf778e | 2013-02-06 22:40:31 +0000 | [diff] [blame] | 12 | // RUN: FileCheck -check-prefix=CHECK-CONFLICT %s < %t.err |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame] | 13 | // CHECK-CONFLICT: PCH was compiled with module cache path |
Douglas Gregor | 8bf778e | 2013-02-06 22:40:31 +0000 | [diff] [blame] | 14 | |
Douglas Gregor | 2a06085 | 2013-02-07 00:21:12 +0000 | [diff] [blame] | 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 |
Douglas Gregor | 953a61f | 2013-02-07 19:01:24 +0000 | [diff] [blame] | 19 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -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 -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED %s -verify |
Douglas Gregor | 2a06085 | 2013-02-07 00:21:12 +0000 | [diff] [blame] | 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 |
Douglas Gregor | 953a61f | 2013-02-07 19:01:24 +0000 | [diff] [blame] | 26 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules-ignore-macro=IGNORED -fmodules -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 -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED -DNO_IGNORED_ANYWHERE -fmodules-ignore-macro=NO_IGNORED_ANYWHERE %s -verify |
Douglas Gregor | 2a06085 | 2013-02-07 00:21:12 +0000 | [diff] [blame] | 28 | |
Douglas Gregor | 005d51b | 2013-02-07 01:18:48 +0000 | [diff] [blame] | 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 |
Douglas Gregor | 953a61f | 2013-02-07 19:01:24 +0000 | [diff] [blame] | 33 | // RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules-ignore-macro=IGNORED=1 -fmodules -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 -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED=1 -DNO_IGNORED_ANYWHERE -fmodules-ignore-macro=NO_IGNORED_ANYWHERE %s -verify |
Douglas Gregor | 005d51b | 2013-02-07 01:18:48 +0000 | [diff] [blame] | 35 | |
Douglas Gregor | 8bf778e | 2013-02-06 22:40:31 +0000 | [diff] [blame] | 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; |
Douglas Gregor | 2a06085 | 2013-02-07 00:21:12 +0000 | [diff] [blame] | 46 | |
| 47 | #ifdef NO_IGNORED_ANYWHERE |
| 48 | void *has_ignored(int, int, int); |
| 49 | #endif |