diff options
author | Eric Liu <ioeric@google.com> | 2017-10-10 13:09:40 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2017-10-10 13:09:40 +0000 |
commit | f01516db8de1b7f7599b3e21f687adc6f2d71df2 (patch) | |
tree | 6c262dbcb89ffa76860da0f94690e83658de5fa4 /clang/lib/AST/Decl.cpp | |
parent | 8cd38554fbd1ff4a3dbece202d10e415aa892eac (diff) | |
download | bcm5719-llvm-f01516db8de1b7f7599b3e21f687adc6f2d71df2.tar.gz bcm5719-llvm-f01516db8de1b7f7599b3e21f687adc6f2d71df2.zip |
Revert "[Modules TS] Module ownership semantics for redeclarations."
This reverts commit r315251. See the original commit thread for reason.
llvm-svn: 315309
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index cdd89d20e6b..6e5f638bd55 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -515,7 +515,6 @@ static bool isSingleLineLanguageLinkage(const Decl &D) { } static bool isExportedFromModuleIntefaceUnit(const NamedDecl *D) { - // FIXME: Handle isModulePrivate. switch (D->getModuleOwnershipKind()) { case Decl::ModuleOwnershipKind::Unowned: case Decl::ModuleOwnershipKind::ModulePrivate: @@ -547,8 +546,7 @@ static LinkageInfo getExternalLinkageFor(const NamedDecl *D) { // declaration has module linkage. if (auto *M = D->getOwningModule()) if (M->Kind == Module::ModuleInterfaceUnit) - if (!isExportedFromModuleIntefaceUnit( - cast<NamedDecl>(D->getCanonicalDecl()))) + if (!isExportedFromModuleIntefaceUnit(D)) return LinkageInfo(ModuleLinkage, DefaultVisibility, false); return LinkageInfo::external(); @@ -1395,7 +1393,7 @@ LinkageInfo LinkageComputer::getDeclLinkageAndVisibility(const NamedDecl *D) { : NamedDecl::VisibilityForValue)); } -Module *Decl::getOwningModuleForLinkage() const { +Module *NamedDecl::getOwningModuleForLinkage() const { Module *M = getOwningModule(); if (!M) return nullptr; @@ -1413,15 +1411,7 @@ Module *Decl::getOwningModuleForLinkage() 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. - bool InternalLinkage; - if (auto *ND = dyn_cast<NamedDecl>(this)) - InternalLinkage = !ND->hasExternalFormalLinkage(); - else { - auto *NSD = dyn_cast<NamespaceDecl>(this); - InternalLinkage = (NSD && NSD->isAnonymousNamespace()) || - isInAnonymousNamespace(); - } - return InternalLinkage ? M->Parent : nullptr; + return hasExternalFormalLinkage() ? nullptr : M->Parent; } llvm_unreachable("unknown module kind"); |