From 4a23ab439cfba3e9b4c7987e6d1c919c97b4e803 Mon Sep 17 00:00:00 2001 From: Orlando Cazalet-Hyams Date: Tue, 20 Feb 2024 17:22:25 +0000 Subject: [PATCH] Fix Wcovered-switch-default Werror after #78252 bot failure: https://lab.llvm.org/buildbot/#/builders/19/builds/24831 --- llvm/lib/IR/DebugProgramInstruction.cpp | 26 +++++++++---------------- 1 file changed, 9 insertions(+), 17 deletions(-) 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(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(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(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(this)->isIdenticalToWhenDefined(*cast(&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(this)->isEquivalentTo(*cast(&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(this)->clone(); - default: - llvm_unreachable("unsupported DbgRecord kind"); }; + llvm_unreachable("unsupported DbgRecord kind"); } DPValue *DPValue::clone() const { return new DPValue(*this); }