[Lldb-commits] [lldb] [LLDB][NFC] Remove dead code (PR #68927)

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 12 14:00:33 PDT 2023


https://github.com/walter-erquinigo created https://github.com/llvm/llvm-project/pull/68927

I found this type/typesystem code that is dead and seems to have been replaced by the ValueObjectPrinter.


>From 2e589d7e13959947bf7c81b089f164ccd8d22906 Mon Sep 17 00:00:00 2001
From: walter erquinigo <walter at modular.com>
Date: Thu, 12 Oct 2023 16:58:08 -0400
Subject: [PATCH] [LLDB][NFC] Remove dead code

I found this type/typesystem code that is dead and seems to have been replaced by the ValueObjectPrinter.
---
 lldb/include/lldb/Symbol/CompilerType.h       |  6 ---
 lldb/include/lldb/Symbol/Type.h               |  9 ----
 lldb/include/lldb/Symbol/TypeSystem.h         | 16 +++----
 .../TypeSystem/Clang/TypeSystemClang.cpp      |  2 +
 .../TypeSystem/Clang/TypeSystemClang.h        | 14 ++++---
 lldb/source/Symbol/CompilerType.cpp           | 14 -------
 lldb/source/Symbol/Type.cpp                   | 42 -------------------
 7 files changed, 19 insertions(+), 84 deletions(-)

diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h
index 2d7092d2c93f84d..1443487229eb83b 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -437,12 +437,6 @@ class CompilerType {
   LLVM_DUMP_METHOD void dump() const;
 #endif
 
-  void DumpValue(ExecutionContext *exe_ctx, Stream *s, lldb::Format format,
-                 const DataExtractor &data, lldb::offset_t data_offset,
-                 size_t data_byte_size, uint32_t bitfield_bit_size,
-                 uint32_t bitfield_bit_offset, bool show_types,
-                 bool show_summary, bool verbose, uint32_t depth);
-
   bool DumpTypeValue(Stream *s, lldb::Format format, const DataExtractor &data,
                      lldb::offset_t data_offset, size_t data_byte_size,
                      uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 046501931d211a7..d7bccae5f413511 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -148,15 +148,6 @@ class Type : public std::enable_shared_from_this<Type>, public UserID {
 
   ConstString GetQualifiedName();
 
-  void DumpValue(ExecutionContext *exe_ctx, Stream *s,
-                 const DataExtractor &data, uint32_t data_offset,
-                 bool show_type, bool show_summary, bool verbose,
-                 lldb::Format format = lldb::eFormatDefault);
-
-  bool DumpValueInMemory(ExecutionContext *exe_ctx, Stream *s,
-                         lldb::addr_t address, AddressType address_type,
-                         bool show_types, bool show_summary, bool verbose);
-
   bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t address,
                       AddressType address_type, DataExtractor &data);
 
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h
index eb6e453e1aec0d0..3dde07504598680 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -384,13 +384,15 @@ class TypeSystem : public PluginInterface,
   dump(lldb::opaque_compiler_type_t type) const = 0;
 #endif
 
-  virtual void DumpValue(lldb::opaque_compiler_type_t type,
-                         ExecutionContext *exe_ctx, Stream &s,
-                         lldb::Format format, const DataExtractor &data,
-                         lldb::offset_t data_offset, size_t data_byte_size,
-                         uint32_t bitfield_bit_size,
-                         uint32_t bitfield_bit_offset, bool show_types,
-                         bool show_summary, bool verbose, uint32_t depth) = 0;
+  /*
+    virtual void DumpValue(lldb::opaque_compiler_type_t type,
+                           ExecutionContext *exe_ctx, Stream &s,
+                           lldb::Format format, const DataExtractor &data,
+                           lldb::offset_t data_offset, size_t data_byte_size,
+                           uint32_t bitfield_bit_size,
+                           uint32_t bitfield_bit_offset, bool show_types,
+                           bool show_summary, bool verbose, uint32_t depth) = 0;
+                           */
 
   virtual bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream &s,
                              lldb::Format format, const DataExtractor &data,
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 69cff0f35ae4ab2..66be5c03c7d8213 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -8512,6 +8512,7 @@ void TypeSystemClang::DumpFromSymbolFile(Stream &s,
   }
 }
 
+/*
 void TypeSystemClang::DumpValue(
     lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream &s,
     lldb::Format format, const lldb_private::DataExtractor &data,
@@ -8885,6 +8886,7 @@ void TypeSystemClang::DumpValue(
     break;
   }
 }
+*/
 
 static bool DumpEnumValue(const clang::QualType &qual_type, Stream &s,
                           const DataExtractor &data, lldb::offset_t byte_offset,
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 0544de3cd33befb..cf5b2e4bccdb7be 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -1029,12 +1029,14 @@ class TypeSystemClang : public TypeSystem {
   ///       The name of the symbol to dump, if it is empty dump all the symbols
   void DumpFromSymbolFile(Stream &s, llvm::StringRef symbol_name);
 
-  void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
-                 Stream &s, lldb::Format format, const DataExtractor &data,
-                 lldb::offset_t data_offset, size_t data_byte_size,
-                 uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
-                 bool show_types, bool show_summary, bool verbose,
-                 uint32_t depth) override;
+  /*
+    void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
+                   Stream &s, lldb::Format format, const DataExtractor &data,
+                   lldb::offset_t data_offset, size_t data_byte_size,
+                   uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+                   bool show_types, bool show_summary, bool verbose,
+                   uint32_t depth) override;
+                   */
 
   bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream &s,
                      lldb::Format format, const DataExtractor &data,
diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp
index 33f7e63d9be415f..30627bf3dbf7307 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -821,20 +821,6 @@ CompilerType::GetIndexOfChildWithName(llvm::StringRef name,
 
 // Dumping types
 
-void CompilerType::DumpValue(ExecutionContext *exe_ctx, Stream *s,
-                             lldb::Format format, const DataExtractor &data,
-                             lldb::offset_t data_byte_offset,
-                             size_t data_byte_size, uint32_t bitfield_bit_size,
-                             uint32_t bitfield_bit_offset, bool show_types,
-                             bool show_summary, bool verbose, uint32_t depth) {
-  if (!IsValid())
-    if (auto type_system_sp = GetTypeSystem())
-      type_system_sp->DumpValue(m_type, exe_ctx, *s, format, data,
-                                data_byte_offset, data_byte_size,
-                                bitfield_bit_size, bitfield_bit_offset,
-                                show_types, show_summary, verbose, depth);
-}
-
 bool CompilerType::DumpTypeValue(Stream *s, lldb::Format format,
                                  const DataExtractor &data,
                                  lldb::offset_t byte_offset, size_t byte_size,
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 66284eb73cad038..5f4c6303334a255 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -312,30 +312,6 @@ ConstString Type::GetBaseName() {
 
 void Type::DumpTypeName(Stream *s) { GetName().Dump(s, "<invalid-type-name>"); }
 
-void Type::DumpValue(ExecutionContext *exe_ctx, Stream *s,
-                     const DataExtractor &data, uint32_t data_byte_offset,
-                     bool show_types, bool show_summary, bool verbose,
-                     lldb::Format format) {
-  if (ResolveCompilerType(ResolveState::Forward)) {
-    if (show_types) {
-      s->PutChar('(');
-      if (verbose)
-        s->Printf("Type{0x%8.8" PRIx64 "} ", GetID());
-      DumpTypeName(s);
-      s->PutCString(") ");
-    }
-
-    GetForwardCompilerType().DumpValue(
-        exe_ctx, s, format == lldb::eFormatDefault ? GetFormat() : format, data,
-        data_byte_offset,
-        GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)
-            .value_or(0),
-        0, // Bitfield bit size
-        0, // Bitfield bit offset
-        show_types, show_summary, verbose, 0);
-  }
-}
-
 Type *Type::GetEncodingType() {
   if (m_encoding_type == nullptr && m_encoding_uid != LLDB_INVALID_UID)
     m_encoding_type = m_symbol_file->ResolveTypeUID(m_encoding_uid);
@@ -416,24 +392,6 @@ lldb::Encoding Type::GetEncoding(uint64_t &count) {
   return GetForwardCompilerType().GetEncoding(count);
 }
 
-bool Type::DumpValueInMemory(ExecutionContext *exe_ctx, Stream *s,
-                             lldb::addr_t address, AddressType address_type,
-                             bool show_types, bool show_summary, bool verbose) {
-  if (address != LLDB_INVALID_ADDRESS) {
-    DataExtractor data;
-    Target *target = nullptr;
-    if (exe_ctx)
-      target = exe_ctx->GetTargetPtr();
-    if (target)
-      data.SetByteOrder(target->GetArchitecture().GetByteOrder());
-    if (ReadFromMemory(exe_ctx, address, address_type, data)) {
-      DumpValue(exe_ctx, s, data, 0, show_types, show_summary, verbose);
-      return true;
-    }
-  }
-  return false;
-}
-
 bool Type::ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
                           AddressType address_type, DataExtractor &data) {
   if (address_type == eAddressTypeFile) {



More information about the lldb-commits mailing list