[Lldb-commits] [lldb] [lldb][AArch64][Linux] Add llvm_unreachable after some RegisterSetType switches (PR #223375)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 14 04:41:58 PDT 2026


https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/223375

The ones where you are supposed to case X: return Y;. We do enable the not fully covered switch warning, so the unreachable just makes the mistake more obvious.

I did not change GetInvalidationMask because this will be refactored by #223373.

>From 94e407b8e9e40a70d564351317d1d44a6d738038 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at arm.com>
Date: Mon, 14 Sep 2026 11:37:35 +0000
Subject: [PATCH] [lldb][AArch64][Linux] Add llvm_unreachable after some
 RegisterSetType switches

The ones where you are supposed to case X: return Y;. We do
enable the not fully covered switch warning, so the unreachable
just makes the mistake more obvious.

I did not change GetInvalidationMask because this will
be refactored by #223373.
---
 .../Process/Linux/NativeRegisterContextLinux_arm64.cpp      | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
index 85781be08c1bc..1889cab95ab66 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -132,6 +132,8 @@ unsigned int NativeRegisterContextLinux_arm64::GetPtraceSet(
   case RegisterSetType::POE:
     return llvm::ELF::NT_ARM_POE;
   }
+
+  llvm_unreachable("No ptrace set for this RegisterType.");
 }
 
 size_t NativeRegisterContextLinux_arm64::GetSetSize(
@@ -166,6 +168,8 @@ size_t NativeRegisterContextLinux_arm64::GetSetSize(
   case RegisterSetType::POE:
     return sizeof(m_poe_regs);
   }
+
+  llvm_unreachable("No set size for this RegisterType.");
 }
 
 void *NativeRegisterContextLinux_arm64::GetSetBuffer(
@@ -198,6 +202,8 @@ void *NativeRegisterContextLinux_arm64::GetSetBuffer(
   case RegisterSetType::POE:
     return &m_poe_regs;
   }
+
+  llvm_unreachable("No set buffer for this RegisterType.");
 }
 
 // A NativeRegisterContext is constructed per thread, but all threads' registers



More information about the lldb-commits mailing list