blob: 669db4ddc2da1aaaa233585c945ec457d5a193dc [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
Douglas Gregor953a61f2013-02-07 19:01:24 +00003// 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 Gregor8bf778e2013-02-06 22:40:31 +00005
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
Douglas Gregor953a61f2013-02-07 19:01:24 +000010// 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 Gregor8bf778e2013-02-06 22:40:31 +000012// RUN: FileCheck -check-prefix=CHECK-CONFLICT %s < %t.err
Stephen Hines0e2c34f2015-03-23 12:09:02 -070013// CHECK-CONFLICT: PCH was compiled with module cache path
Douglas Gregor8bf778e2013-02-06 22:40:31 +000014
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
Douglas Gregor953a61f2013-02-07 19:01:24 +000019// 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 Gregor2a060852013-02-07 00:21:12 +000021
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 Gregor953a61f2013-02-07 19:01:24 +000026// 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 Gregor2a060852013-02-07 00:21:12 +000028
Douglas Gregor005d51b2013-02-07 01:18:48 +000029// 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 Gregor953a61f2013-02-07 19:01:24 +000033// 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 Gregor005d51b2013-02-07 01:18:48 +000035
Douglas Gregor8bf778e2013-02-06 22:40:31 +000036// expected-no-diagnostics
37
38#ifndef HEADER
39#define HEADER
40@import ignored_macros;
41#endif
42
43@import ignored_macros;
44
45struct Point p;
Douglas Gregor2a060852013-02-07 00:21:12 +000046
47#ifdef NO_IGNORED_ANYWHERE
48void *has_ignored(int, int, int);
49#endif