r239504 - [modules] Fix a few places where merging wasn't performed if modules was disabled but local module visibilty was enabled.
Richard Smith
richard-llvm at metafoo.co.uk
Wed Jun 10 20:05:40 PDT 2015
Author: rsmith
Date: Wed Jun 10 22:05:39 2015
New Revision: 239504
URL: http://llvm.org/viewvc/llvm-project?rev=239504&view=rev
Log:
[modules] Fix a few places where merging wasn't performed if modules was disabled but local module visibilty was enabled.
Added:
cfe/trunk/test/Modules/Inputs/submodules-merge-defs/indirect.h
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/Modules/Inputs/submodules-merge-defs/defs.h
cfe/trunk/test/Modules/Inputs/submodules-merge-defs/module.modulemap
cfe/trunk/test/Modules/submodules-merge-defs.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=239504&r1=239503&r2=239504&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Jun 10 22:05:39 2015
@@ -1788,7 +1788,7 @@ static void filterNonConflictingPrevious
NamedDecl *decl,
LookupResult &previous){
// This is only interesting when modules are enabled.
- if (!S.getLangOpts().Modules)
+ if (!S.getLangOpts().Modules && !S.getLangOpts().ModulesLocalVisibility)
return;
// Empty sets are uninteresting.
@@ -1818,7 +1818,7 @@ static void filterNonConflictingPrevious
TypedefNameDecl *Decl,
LookupResult &Previous) {
// This is only interesting when modules are enabled.
- if (!S.getLangOpts().Modules)
+ if (!S.getLangOpts().Modules && !S.getLangOpts().ModulesLocalVisibility)
return;
// Empty sets are uninteresting.
@@ -13488,7 +13488,8 @@ EnumConstantDecl *Sema::CheckEnumConstan
Sema::SkipBodyInfo Sema::shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II,
SourceLocation IILoc) {
- if (!getLangOpts().Modules || !getLangOpts().CPlusPlus)
+ if (!(getLangOpts().Modules || getLangOpts().ModulesLocalVisibility) ||
+ !getLangOpts().CPlusPlus)
return SkipBodyInfo();
// We have an anonymous enum definition. Look up the first enumerator to
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=239504&r1=239503&r2=239504&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Jun 10 22:05:39 2015
@@ -5153,7 +5153,7 @@ bool Sema::RequireCompleteType(SourceLoc
/// in order to provide a definition of this entity.
bool Sema::hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested) {
// Easy case: if we don't have modules, all declarations are visible.
- if (!getLangOpts().Modules)
+ if (!getLangOpts().Modules && !getLangOpts().ModulesLocalVisibility)
return true;
// If this definition was instantiated from a template, map back to the
Modified: cfe/trunk/test/Modules/Inputs/submodules-merge-defs/defs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/submodules-merge-defs/defs.h?rev=239504&r1=239503&r2=239504&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/submodules-merge-defs/defs.h (original)
+++ cfe/trunk/test/Modules/Inputs/submodules-merge-defs/defs.h Wed Jun 10 22:05:39 2015
@@ -46,3 +46,11 @@ namespace G {
template<typename T = int, int N = 3, template<typename> class K = F> int H(int a = 1);
template<typename T = int, int N = 3, template<typename> class K = F> using I = decltype(H<T, N, K>());
+
+namespace NS {
+ struct A {};
+ template<typename T> struct B {};
+ template<typename T> struct B<T*> {};
+ template<> struct B<int> {};
+ inline void f() {}
+}
Added: cfe/trunk/test/Modules/Inputs/submodules-merge-defs/indirect.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/submodules-merge-defs/indirect.h?rev=239504&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/submodules-merge-defs/indirect.h (added)
+++ cfe/trunk/test/Modules/Inputs/submodules-merge-defs/indirect.h Wed Jun 10 22:05:39 2015
@@ -0,0 +1 @@
+#include "merged-defs.h"
Modified: cfe/trunk/test/Modules/Inputs/submodules-merge-defs/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/submodules-merge-defs/module.modulemap?rev=239504&r1=239503&r2=239504&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/submodules-merge-defs/module.modulemap (original)
+++ cfe/trunk/test/Modules/Inputs/submodules-merge-defs/module.modulemap Wed Jun 10 22:05:39 2015
@@ -14,3 +14,8 @@ module "merged-defs" {
header "merged-defs.h"
use "stuff"
}
+
+module "indirect" {
+ header "indirect.h"
+ use "merged-defs"
+}
Modified: cfe/trunk/test/Modules/submodules-merge-defs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodules-merge-defs.cpp?rev=239504&r1=239503&r2=239504&view=diff
==============================================================================
--- cfe/trunk/test/Modules/submodules-merge-defs.cpp (original)
+++ cfe/trunk/test/Modules/submodules-merge-defs.cpp Wed Jun 10 22:05:39 2015
@@ -3,9 +3,13 @@
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -DTEXTUAL
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility
+// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodule-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -DTEXTUAL -DEARLY_INDIRECT_INCLUDE
// Trigger import of definitions, but don't make them visible.
#include "empty.h"
+#ifdef EARLY_INDIRECT_INCLUDE
+#include "indirect.h"
+#endif
A pre_a; // expected-error {{must be imported}} expected-error {{must use 'struct'}}
// expected-note at defs.h:1 +{{here}}
@@ -54,3 +58,10 @@ int post_use_dx = use_dx(post_dx);
int post_e = E(0);
int post_ff = F<char>().f();
int post_fg = F<char>().g<int>();
+#ifdef EARLY_INDIRECT_INCLUDE
+// FIXME: Properly track the owning module for a member specialization.
+// expected-error at defs.h:34 {{redefinition}}
+// expected-note at defs.h:34 {{previous definition}}
+// expected-error at -5 {{no matching member function}}
+// expected-note at defs.h:34 {{substitution failure}}
+#endif
More information about the cfe-commits
mailing list