summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/DeclBase.h5
-rw-r--r--clang/include/clang/Sema/Sema.h7
-rw-r--r--clang/lib/AST/Decl.cpp4
-rw-r--r--clang/test/Modules/anon-linkage.cpp12
4 files changed, 4 insertions, 24 deletions
diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h
index 47515a848a4..aa278c301ed 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -740,10 +740,7 @@ public:
/// Get the module that owns this declaration for linkage purposes.
/// There only ever is such a module under the C++ Modules TS.
- ///
- /// \param IgnoreLinkage Ignore the linkage of the entity; assume that
- /// all declarations in a global module fragment are unowned.
- Module *getOwningModuleForLinkage(bool IgnoreLinkage = false) const;
+ Module *getOwningModuleForLinkage() const;
/// \brief Determine whether this declaration might be hidden from name
/// lookup. Note that the declaration might be visible even if this returns
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 277c62f5439..f32fafa447b 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -3051,11 +3051,8 @@ public:
RedeclarationKind forRedeclarationInCurContext() {
// A declaration with an owning module for linkage can never link against
- // anything that is not visible. We don't need to check linkage here; if
- // the context has internal linkage, redeclaration lookup won't find things
- // from other TUs, and we can't safely compute linkage yet in general.
- if (cast<Decl>(CurContext)
- ->getOwningModuleForLinkage(/*IgnoreLinkage*/true))
+ // anything that is not visible.
+ if (cast<Decl>(CurContext)->getOwningModuleForLinkage())
return ForVisibleRedeclaration;
return ForExternalRedeclaration;
}
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 4a9b9bea830..cdd89d20e6b 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1395,7 +1395,7 @@ LinkageInfo LinkageComputer::getDeclLinkageAndVisibility(const NamedDecl *D) {
: NamedDecl::VisibilityForValue));
}
-Module *Decl::getOwningModuleForLinkage(bool IgnoreLinkage) const {
+Module *Decl::getOwningModuleForLinkage() const {
Module *M = getOwningModule();
if (!M)
return nullptr;
@@ -1413,8 +1413,6 @@ Module *Decl::getOwningModuleForLinkage(bool IgnoreLinkage) const {
// for linkage purposes. But internal linkage declarations in the global
// module fragment of a particular module are owned by that module for
// linkage purposes.
- if (IgnoreLinkage)
- return nullptr;
bool InternalLinkage;
if (auto *ND = dyn_cast<NamedDecl>(this))
InternalLinkage = !ND->hasExternalFormalLinkage();
diff --git a/clang/test/Modules/anon-linkage.cpp b/clang/test/Modules/anon-linkage.cpp
deleted file mode 100644
index 590638292b5..00000000000
--- a/clang/test/Modules/anon-linkage.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang_cc1 -std=c++17 -fmodules-ts %s
-
-typedef struct {
- int c;
- union {
- int n;
- char c[4];
- } v;
-} mbstate;
-
-export module M;
-export using ::mbstate;
OpenPOWER on IntegriCloud