diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-21 01:20:10 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-21 01:20:10 +0000 |
commit | 04765ae01e936a3f2bc980ebd8fc7ea8a4760636 (patch) | |
tree | b5a150687a94b1b7cf20fbad6067172a2013e341 /clang/test/Modules | |
parent | de0aff3e9109ac9444b4408aa7619204344f54ed (diff) | |
download | bcm5719-llvm-04765ae01e936a3f2bc980ebd8fc7ea8a4760636.tar.gz bcm5719-llvm-04765ae01e936a3f2bc980ebd8fc7ea8a4760636.zip |
[modules] If we re-enter a submodule from within itself (when submodule
visibility is enabled) or leave and re-enter it, restore the macro and module
visibility state from last time we were in that submodule.
This allows mutually-#including header files to stand a chance at being
modularized with local visibility enabled.
llvm-svn: 237871
Diffstat (limited to 'clang/test/Modules')
4 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/submodule-visibility/cycle1.h b/clang/test/Modules/Inputs/submodule-visibility/cycle1.h new file mode 100644 index 00000000000..05e85aef10d --- /dev/null +++ b/clang/test/Modules/Inputs/submodule-visibility/cycle1.h @@ -0,0 +1,8 @@ +#ifndef CYCLE1 +#define CYCLE1 + +#include "cycle2.h" + +struct C1 {}; + +#endif diff --git a/clang/test/Modules/Inputs/submodule-visibility/cycle2.h b/clang/test/Modules/Inputs/submodule-visibility/cycle2.h new file mode 100644 index 00000000000..de9fd8e01aa --- /dev/null +++ b/clang/test/Modules/Inputs/submodule-visibility/cycle2.h @@ -0,0 +1,8 @@ +#ifndef CYCLE2 +#define CYCLE2 + +#include "cycle1.h" + +struct C2 {}; + +#endif diff --git a/clang/test/Modules/Inputs/submodule-visibility/module.modulemap b/clang/test/Modules/Inputs/submodule-visibility/module.modulemap index 447a1f42d45..2e13344dc63 100644 --- a/clang/test/Modules/Inputs/submodule-visibility/module.modulemap +++ b/clang/test/Modules/Inputs/submodule-visibility/module.modulemap @@ -1 +1,6 @@ module x { module a { header "a.h" } module b { header "b.h" } } + +module cycles { + module cycle1 { header "cycle1.h" } + module cycle2 { header "cycle2.h" } +} diff --git a/clang/test/Modules/submodule-visibility-cycles.cpp b/clang/test/Modules/submodule-visibility-cycles.cpp new file mode 100644 index 00000000000..fca8df9f77e --- /dev/null +++ b/clang/test/Modules/submodule-visibility-cycles.cpp @@ -0,0 +1,10 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fno-modules-error-recovery -fmodules-local-submodule-visibility -fmodules-cache-path=%t -I%S/Inputs/submodule-visibility -verify %s + +#include "cycle1.h" +C1 c1; +C2 c2; // expected-error {{must be imported}} expected-error {{}} +// expected-note@cycle2.h:6 {{here}} + +#include "cycle2.h" +C2 c3; |