[Lldb-commits] [lldb] [lldb][nfc] Remove unused member Disassembler::m_base_addr (PR #89289)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 18 11:38:52 PDT 2024


https://github.com/bulbazord created https://github.com/llvm/llvm-project/pull/89289

This member variable is completely unused. I also don't think it makes a ton of sense since (1) The "base address" can be obtained from the first Instruction in its InstructionList, and (2) InstructionLists may not be a series of contiguous instructions (even though they are most of the time).

>From 821713962ebe64cf72dea81a443c6e30ef52abaf Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Thu, 18 Apr 2024 11:35:21 -0700
Subject: [PATCH] [lldb][nfc] Remove unused member Disassembler::m_base_addr

This member variable is completely unused. I also don't think it makes a
ton of sense since (1) The "base address" can be obtained from the first
Instruction in its InstructionList, and (2) InstructionLists may not be
a series of contiguous instructions (even though they are most of the
time).
---
 lldb/include/lldb/Core/Disassembler.h | 1 -
 lldb/source/Core/Disassembler.cpp     | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h
index e037a49f152c74..21969aed03c209 100644
--- a/lldb/include/lldb/Core/Disassembler.h
+++ b/lldb/include/lldb/Core/Disassembler.h
@@ -547,7 +547,6 @@ class Disassembler : public std::enable_shared_from_this<Disassembler>,
   // Classes that inherit from Disassembler can see and modify these
   ArchSpec m_arch;
   InstructionList m_instruction_list;
-  lldb::addr_t m_base_addr;
   std::string m_flavor;
 
 private:
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index e31746fa0b8b9d..9286f62058bc8d 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -1117,8 +1117,7 @@ size_t Disassembler::ParseInstructions(Target &target, Address start,
 
 // Disassembler copy constructor
 Disassembler::Disassembler(const ArchSpec &arch, const char *flavor)
-    : m_arch(arch), m_instruction_list(), m_base_addr(LLDB_INVALID_ADDRESS),
-      m_flavor() {
+    : m_arch(arch), m_instruction_list(), m_flavor() {
   if (flavor == nullptr)
     m_flavor.assign("default");
   else



More information about the lldb-commits mailing list