diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-02-07 00:21:12 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-02-07 00:21:12 +0000 |
commit | 2a06085281d1b6aee628f85e8676eec04542cbc9 (patch) | |
tree | 555fd6e3a34befb20718444336bf6667927a6261 /test/Modules | |
parent | 712f5b3bef988e8d3dd38fdf2264e7cc1a3f6bf9 (diff) |
Introduce -fmodules-ignore-macro=NNN to ignore a macro when building/loading modules.
The use of this flag enables a modules optimization where a given set
of macros can be labeled as "ignored" by the modules
system. Definitions of those macros will be completely ignored when
building the module hash and will be stripped when actually building
modules. The overall effect is that this flag can be used to
drastically reduce the number of
Eventually, we'll want modules to tell us what set of macros they
respond to (the "configuration macros"), and anything not in that set
will be excluded. However, that requires a lot of per-module
information that must be accurate, whereas this option can be used
more readily.
Fixes the rest of <rdar://problem/13165109>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174560 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules')
-rw-r--r-- | test/Modules/ignored_macros.m | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/test/Modules/ignored_macros.m b/test/Modules/ignored_macros.m index 1f9c27c2a3..3d5f359b31 100644 --- a/test/Modules/ignored_macros.m +++ b/test/Modules/ignored_macros.m @@ -1,15 +1,31 @@ -// First trial: pass -DIGNORED=1 to both. It should be ignored in both +// First trial: pass -DIGNORED=1 to both. This should obviously work. // RUN: rm -rf %t.modules // 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 // RUN: %clang_cc1 -fmodule-cache-path %t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch %s -verify -// Second trial: pass -DIGNORED=1 only to the second invocation. +// Second trial: pass -DIGNORED=1 only to the second invocation. We +// should detect the failure. +// // RUN: rm -rf %t.modules // RUN: %clang_cc1 -fmodule-cache-path %t.modules -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify // RUN: not %clang_cc1 -fmodule-cache-path %t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch %s > %t.err 2>&1 // RUN: FileCheck -check-prefix=CHECK-CONFLICT %s < %t.err // CHECK-CONFLICT: module 'ignored_macros' found in both +// Third trial: pass -DIGNORED=1 only to the second invocation, but +// make it ignored. There should be no failure, IGNORED is defined in +// the translation unit but not the module. +// RUN: rm -rf %t.modules +// RUN: %clang_cc1 -fmodule-cache-path %t.modules -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify +// RUN: %clang_cc1 -fmodule-cache-path %t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED %s -verify + +// Fourth trial: pass -DIGNORED=1 and -fmodules-ignore-macro=IGNORED +// to both invocations, so modules will be built without the IGNORED +// macro. +// RUN: rm -rf %t.modules +// 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 +// 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 + // expected-no-diagnostics #ifndef HEADER @@ -20,3 +36,7 @@ @import ignored_macros; struct Point p; + +#ifdef NO_IGNORED_ANYWHERE +void *has_ignored(int, int, int); +#endif |