[clang] [clang-tools-extra] [clang][NFC] Refactor `clang::Linkage` (PR #71049)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 2 05:28:16 PDT 2023


================
@@ -1921,7 +1920,20 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const {
 }
 
 bool NamedDecl::hasLinkage() const {
-  return getFormalLinkage() != NoLinkage;
+  switch (getFormalLinkage()) {
+  case Linkage::Invalid:
+    llvm_unreachable("Linkage hasn't been computed!");
+  case Linkage::None:
+    return false;
+  case Linkage::Internal:
+    return true;
+  case Linkage::UniqueExternal:
+  case Linkage::VisibleNone:
+    llvm_unreachable("Non-formal linkage is not allowed here!");
----------------
AaronBallman wrote:

Can you explain this change a bit? This looks like a functional change?

https://github.com/llvm/llvm-project/pull/71049


More information about the cfe-commits mailing list