[PATCH] D118704: [clang][NFC] Remove unreachable code

Nathan Sidwell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 2 05:14:52 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGccf02cdf17d6: [clang][NFC] Remove unreachable code (authored by urnathan).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118704/new/

https://reviews.llvm.org/D118704

Files:
  clang/lib/AST/Decl.cpp


Index: clang/lib/AST/Decl.cpp
===================================================================
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -1557,16 +1557,16 @@
     // 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;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118704.405228.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220202/70dd2cad/attachment.bin>


More information about the cfe-commits mailing list