[Lldb-commits] [lldb] r368249 - [Materializer] Remove wrong SetSizeAndAlignmentFromType().

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 7 20:15:48 PDT 2019


Author: davide
Date: Wed Aug  7 20:15:48 2019
New Revision: 368249

URL: http://llvm.org/viewvc/llvm-project?rev=368249&view=rev
Log:
[Materializer] Remove wrong SetSizeAndAlignmentFromType().

This function is unused.  It's also wrong, because it computes
the size and the alignment of the type without asking the runtime,
so it doesn't work for any language that has one (e.g. swift).

One could consider re-implementing this passing an execution scope
context, and modifying GetTypeBitAlign() to do the right thing,
but given there are no uses, it's not really useful.

Modified:
    lldb/trunk/include/lldb/Expression/Materializer.h
    lldb/trunk/source/Expression/Materializer.cpp

Modified: lldb/trunk/include/lldb/Expression/Materializer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/Materializer.h?rev=368249&r1=368248&r2=368249&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/Materializer.h (original)
+++ lldb/trunk/include/lldb/Expression/Materializer.h Wed Aug  7 20:15:48 2019
@@ -115,8 +115,6 @@ public:
     void SetOffset(uint32_t offset) { m_offset = offset; }
 
   protected:
-    void SetSizeAndAlignmentFromType(CompilerType &type);
-
     uint32_t m_alignment;
     uint32_t m_size;
     uint32_t m_offset;

Modified: lldb/trunk/source/Expression/Materializer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=368249&r1=368248&r2=368249&view=diff
==============================================================================
--- lldb/trunk/source/Expression/Materializer.cpp (original)
+++ lldb/trunk/source/Expression/Materializer.cpp Wed Aug  7 20:15:48 2019
@@ -45,20 +45,6 @@ uint32_t Materializer::AddStructMember(E
   return ret;
 }
 
-void Materializer::Entity::SetSizeAndAlignmentFromType(CompilerType &type) {
-  if (llvm::Optional<uint64_t> size = type.GetByteSize(nullptr))
-    m_size = *size;
-
-  uint32_t bit_alignment = type.GetTypeBitAlign();
-
-  if (bit_alignment % 8) {
-    bit_alignment += 8;
-    bit_alignment &= ~((uint32_t)0x111u);
-  }
-
-  m_alignment = bit_alignment / 8;
-}
-
 class EntityPersistentVariable : public Materializer::Entity {
 public:
   EntityPersistentVariable(lldb::ExpressionVariableSP &persistent_variable_sp,




More information about the lldb-commits mailing list