diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-02 00:45:56 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-02 00:45:56 +0000 |
commit | 38477db8c4a0bfddb7c749de2de50ccd47d4ef54 (patch) | |
tree | c521354f8853fe82d7105e7f5e4114d19c25877a /clang/test | |
parent | ae4c2649dce019d431b7f8e231d6f198bcab8bdf (diff) | |
download | bcm5719-llvm-38477db8c4a0bfddb7c749de2de50ccd47d4ef54.tar.gz bcm5719-llvm-38477db8c4a0bfddb7c749de2de50ccd47d4ef54.zip |
[modules] If a module #includes a modular header that #undef's its macro, it
should not export the macro.
... at least, not unless we have local submodule visibility enabled.
llvm-svn: 236369
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Modules/Inputs/macro-masking/a.h | 2 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/macro-masking/b.h | 1 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/macro-masking/module.modulemap | 4 | ||||
-rw-r--r-- | clang/test/Modules/macro-masking.cpp | 16 |
4 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/macro-masking/a.h b/clang/test/Modules/Inputs/macro-masking/a.h new file mode 100644 index 00000000000..dbc17b8cbcf --- /dev/null +++ b/clang/test/Modules/Inputs/macro-masking/a.h @@ -0,0 +1,2 @@ +#define MACRO +#include "b.h" diff --git a/clang/test/Modules/Inputs/macro-masking/b.h b/clang/test/Modules/Inputs/macro-masking/b.h new file mode 100644 index 00000000000..0d14daf13af --- /dev/null +++ b/clang/test/Modules/Inputs/macro-masking/b.h @@ -0,0 +1 @@ +#undef MACRO diff --git a/clang/test/Modules/Inputs/macro-masking/module.modulemap b/clang/test/Modules/Inputs/macro-masking/module.modulemap new file mode 100644 index 00000000000..63e1014dda8 --- /dev/null +++ b/clang/test/Modules/Inputs/macro-masking/module.modulemap @@ -0,0 +1,4 @@ +module X { + module A { header "a.h" export * } + module B { header "b.h" export * } +} diff --git a/clang/test/Modules/macro-masking.cpp b/clang/test/Modules/macro-masking.cpp new file mode 100644 index 00000000000..3d4e8e0ba49 --- /dev/null +++ b/clang/test/Modules/macro-masking.cpp @@ -0,0 +1,16 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fsyntax-only -fmodules %s -fmodules-cache-path=%t -verify -I%S/Inputs/macro-masking +// RxN: %clang_cc1 -fsyntax-only -fmodules -fmodules-local-submodule-visibility %s -fmodules-cache-path=%t -verify -I%S/Inputs/macro-masking -DLOCAL_VISIBILITY +// expected-no-diagnostics + +#include "a.h" + +#ifdef LOCAL_VISIBILITY +# ifndef MACRO +# error should still be defined, undef does not override define +# endif +#else +# ifdef MACRO +# error should have been undefined! +# endif +#endif |