[Lldb-commits] [lldb] [lldb][nfc] Fix incorrect union usage in UnwindAssemblyInstEmulation (PR #168341)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 17 02:39:15 PST 2025


https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/168341

This is harmless due to the previous checks for > 0, but it is still confusing for the readers.

>From a62f582de65fd00b2041326265003131328fc08b Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: Fri, 14 Nov 2025 16:07:49 +0000
Subject: [PATCH] [lldb][nfc] Fix incorrect union usage in
 UnwindAssemblyInstEmulation

This is harmless due to the previous checks for > 0, but it is still
confusing for the readers.
---
 .../InstEmulation/UnwindAssemblyInstEmulation.cpp           | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
index 790f230af74c9..9c0b2998c37e5 100644
--- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -505,12 +505,12 @@ bool UnwindAssemblyInstEmulation::WriteRegister(
   case EmulateInstruction::eContextRelativeBranchImmediate: {
     if (context.GetInfoType() == EmulateInstruction::eInfoTypeISAAndImmediate &&
         context.info.ISAAndImmediate.unsigned_data32 > 0) {
-      m_forward_branch_offset =
-          context.info.ISAAndImmediateSigned.signed_data32;
+      m_forward_branch_offset = context.info.ISAAndImmediate.unsigned_data32;
     } else if (context.GetInfoType() ==
                    EmulateInstruction::eInfoTypeISAAndImmediateSigned &&
                context.info.ISAAndImmediateSigned.signed_data32 > 0) {
-      m_forward_branch_offset = context.info.ISAAndImmediate.unsigned_data32;
+      m_forward_branch_offset =
+          context.info.ISAAndImmediateSigned.signed_data32;
     } else if (context.GetInfoType() ==
                    EmulateInstruction::eInfoTypeImmediate &&
                context.info.unsigned_immediate > 0) {



More information about the lldb-commits mailing list