Skip to content

Commit ccf02cd

Browse files
committed
[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
1 parent ec10ff3 commit ccf02cd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

clang/lib/AST/Decl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,16 +1557,16 @@ Module *Decl::getOwningModuleForLinkage(bool IgnoreLinkage) const {
15571557
// for linkage purposes. But internal linkage declarations in the global
15581558
// module fragment of a particular module are owned by that module for
15591559
// linkage purposes.
1560+
// FIXME: p1815 removes the need for this distinction -- there are no
1561+
// internal linkage declarations that need to be referred to from outside
1562+
// this TU.
15601563
if (IgnoreLinkage)
15611564
return nullptr;
15621565
bool InternalLinkage;
15631566
if (auto *ND = dyn_cast<NamedDecl>(this))
15641567
InternalLinkage = !ND->hasExternalFormalLinkage();
1565-
else {
1566-
auto *NSD = dyn_cast<NamespaceDecl>(this);
1567-
InternalLinkage = (NSD && NSD->isAnonymousNamespace()) ||
1568-
isInAnonymousNamespace();
1569-
}
1568+
else
1569+
InternalLinkage = isInAnonymousNamespace();
15701570
return InternalLinkage ? M->Parent : nullptr;
15711571
}
15721572

0 commit comments

Comments
 (0)