forked from OSchip/llvm-project
[clang][NFC] Remove unreachable code
NamespaceDecls are NamedDecls, so NSD can never be non-null in the else branch. Add a comment about this whole ModuleInternal linkage concept going away when p1815 is implemented. Reviewed By: bruno Differential Revision: https://reviews.llvm.org/D118704
This commit is contained in:
parent
ec10ff37e2
commit
ccf02cdf17
|
@ -1557,16 +1557,16 @@ 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.
|
||||
// FIXME: p1815 removes the need for this distinction -- there are no
|
||||
// internal linkage declarations that need to be referred to from outside
|
||||
// this TU.
|
||||
if (IgnoreLinkage)
|
||||
return nullptr;
|
||||
bool InternalLinkage;
|
||||
if (auto *ND = dyn_cast<NamedDecl>(this))
|
||||
InternalLinkage = !ND->hasExternalFormalLinkage();
|
||||
else {
|
||||
auto *NSD = dyn_cast<NamespaceDecl>(this);
|
||||
InternalLinkage = (NSD && NSD->isAnonymousNamespace()) ||
|
||||
isInAnonymousNamespace();
|
||||
}
|
||||
else
|
||||
InternalLinkage = isInAnonymousNamespace();
|
||||
return InternalLinkage ? M->Parent : nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue