blob: 3d5f359b3170ebeb5212b628f543655714896172 [file] [log] [blame]
Douglas Gregor2a060852013-02-07 00:21:12 +00001// First trial: pass -DIGNORED=1 to both. This should obviously work.
Douglas Gregor8bf778e2013-02-06 22:40:31 +00002// RUN: rm -rf %t.modules
3// RUN: %clang_cc1 -fmodule-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 -fmodule-cache-path %t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch %s -verify
5
Douglas Gregor2a060852013-02-07 00:21:12 +00006// Second trial: pass -DIGNORED=1 only to the second invocation. We
7// should detect the failure.
8//
Douglas Gregor8bf778e2013-02-06 22:40:31 +00009// RUN: rm -rf %t.modules
10// RUN: %clang_cc1 -fmodule-cache-path %t.modules -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify
11// RUN: not %clang_cc1 -fmodule-cache-path %t.modules -DIGNORED=1 -fmodules -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: module 'ignored_macros' found in both
14
Douglas Gregor2a060852013-02-07 00:21:12 +000015// 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 -fmodule-cache-path %t.modules -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify
20// RUN: %clang_cc1 -fmodule-cache-path %t.modules -DIGNORED=1 -fmodules -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 -fmodule-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 -fmodule-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
28
Douglas Gregor8bf778e2013-02-06 22:40:31 +000029// expected-no-diagnostics
30
31#ifndef HEADER
32#define HEADER
33@import ignored_macros;
34#endif
35
36@import ignored_macros;
37
38struct Point p;
Douglas Gregor2a060852013-02-07 00:21:12 +000039
40#ifdef NO_IGNORED_ANYWHERE
41void *has_ignored(int, int, int);
42#endif