[llvm] 4a23ab4 - Fix Wcovered-switch-default Werror after #78252

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 09:29:43 PST 2024


Author: Orlando Cazalet-Hyams
Date: 2024-02-20T17:29:16Z
New Revision: 4a23ab439cfba3e9b4c7987e6d1c919c97b4e803

URL: https://github.com/llvm/llvm-project/commit/4a23ab439cfba3e9b4c7987e6d1c919c97b4e803
DIFF: https://github.com/llvm/llvm-project/commit/4a23ab439cfba3e9b4c7987e6d1c919c97b4e803.diff

LOG: Fix Wcovered-switch-default Werror after #78252

bot failure: https://lab.llvm.org/buildbot/#/builders/19/builds/24831

Added: 
    

Modified: 
    llvm/lib/IR/DebugProgramInstruction.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp
index 9568b2257e61a0..eb18be5d817a9d 100644
--- a/llvm/lib/IR/DebugProgramInstruction.cpp
+++ b/llvm/lib/IR/DebugProgramInstruction.cpp
@@ -63,20 +63,18 @@ void DbgRecord::deleteRecord() {
   switch (RecordKind) {
   case ValueKind:
     delete cast<DPValue>(this);
-    break;
-  default:
-    llvm_unreachable("unsupported DbgRecord kind");
+    return;
   }
+  llvm_unreachable("unsupported DbgRecord kind");
 }
 
 void DbgRecord::print(raw_ostream &O, bool IsForDebug) const {
   switch (RecordKind) {
   case ValueKind:
     cast<DPValue>(this)->print(O, IsForDebug);
-    break;
-  default:
-    llvm_unreachable("unsupported DbgRecord kind");
+    return;
   };
+  llvm_unreachable("unsupported DbgRecord kind");
 }
 
 void DbgRecord::print(raw_ostream &O, ModuleSlotTracker &MST,
@@ -84,10 +82,9 @@ void DbgRecord::print(raw_ostream &O, ModuleSlotTracker &MST,
   switch (RecordKind) {
   case ValueKind:
     cast<DPValue>(this)->print(O, MST, IsForDebug);
-    break;
-  default:
-    llvm_unreachable("unsupported DbgRecord kind");
+    return;
   };
+  llvm_unreachable("unsupported DbgRecord kind");
 }
 
 bool DbgRecord::isIdenticalToWhenDefined(const DbgRecord &R) const {
@@ -96,10 +93,8 @@ bool DbgRecord::isIdenticalToWhenDefined(const DbgRecord &R) const {
   switch (RecordKind) {
   case ValueKind:
     return cast<DPValue>(this)->isIdenticalToWhenDefined(*cast<DPValue>(&R));
-    break;
-  default:
-    llvm_unreachable("unsupported DbgRecord kind");
   };
+  llvm_unreachable("unsupported DbgRecord kind");
 }
 
 bool DbgRecord::isEquivalentTo(const DbgRecord &R) const {
@@ -108,10 +103,8 @@ bool DbgRecord::isEquivalentTo(const DbgRecord &R) const {
   switch (RecordKind) {
   case ValueKind:
     return cast<DPValue>(this)->isEquivalentTo(*cast<DPValue>(&R));
-    break;
-  default:
-    llvm_unreachable("unsupported DbgRecord kind");
   };
+  llvm_unreachable("unsupported DbgRecord kind");
 }
 
 DPValue *DPValue::createDPValue(Value *Location, DILocalVariable *DV,
@@ -314,9 +307,8 @@ DbgRecord *DbgRecord::clone() const {
   switch (RecordKind) {
   case ValueKind:
     return cast<DPValue>(this)->clone();
-  default:
-    llvm_unreachable("unsupported DbgRecord kind");
   };
+  llvm_unreachable("unsupported DbgRecord kind");
 }
 
 DPValue *DPValue::clone() const { return new DPValue(*this); }


        


More information about the llvm-commits mailing list