aprantl created this revision.
aprantl added reviewers: jingham, clayborg, labath, jasonmolenda.
Herald added a project: LLDB.
aprantl updated this revision to Diff 214024.

Value::GetValueAsData() takes an undocumented parameter called data_offset that 
is always 0. I couldn't figure out what it is supposed to be used for and it is 
never used, so here's a patch to remove it.


https://reviews.llvm.org/D65910

Files:
  lldb/include/lldb/Core/Value.h
  lldb/source/Core/Value.cpp
  lldb/source/Core/ValueObject.cpp
  lldb/source/Core/ValueObjectCast.cpp
  lldb/source/Core/ValueObjectChild.cpp
  lldb/source/Core/ValueObjectConstResult.cpp
  lldb/source/Core/ValueObjectDynamicValue.cpp
  lldb/source/Core/ValueObjectMemory.cpp
  lldb/source/Core/ValueObjectSyntheticFilter.cpp
  lldb/source/Core/ValueObjectVariable.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp

Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
===================================================================
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -543,7 +543,7 @@
     Status error;
     DataExtractor data;
     error = argument_values.GetValueAtIndex(0)->GetValueAsData(&exe_ctx, data,
-                                                               0, nullptr);
+                                                               nullptr);
     lldb::offset_t offset = 0;
     lldb::addr_t region_addr = data.GetPointer(&offset);
 
Index: lldb/source/Core/ValueObjectVariable.cpp
===================================================================
--- lldb/source/Core/ValueObjectVariable.cpp
+++ lldb/source/Core/ValueObjectVariable.cpp
@@ -221,7 +221,7 @@
         // The variable value is in the Scalar value inside the m_value. We can
         // point our m_data right to it.
         m_error =
-            m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+            m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
         break;
 
       case Value::eValueTypeFileAddress:
@@ -250,7 +250,7 @@
           Value value(m_value);
           value.SetContext(Value::eContextTypeVariable, variable);
           m_error =
-              value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+              value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
 
           SetValueDidChange(value_type != old_value.GetValueType() ||
                             m_value.GetScalar() != old_value.GetScalar());
Index: lldb/source/Core/ValueObjectSyntheticFilter.cpp
===================================================================
--- lldb/source/Core/ValueObjectSyntheticFilter.cpp
+++ lldb/source/Core/ValueObjectSyntheticFilter.cpp
@@ -320,7 +320,7 @@
 void ValueObjectSynthetic::CopyValueData(ValueObject *source) {
   m_value = (source->UpdateValueIfNeeded(), source->GetValue());
   ExecutionContext exe_ctx(GetExecutionContextRef());
-  m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+  m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
 }
 
 bool ValueObjectSynthetic::CanProvideValue() {
Index: lldb/source/Core/ValueObjectMemory.cpp
===================================================================
--- lldb/source/Core/ValueObjectMemory.cpp
+++ lldb/source/Core/ValueObjectMemory.cpp
@@ -168,7 +168,7 @@
     case Value::eValueTypeScalar:
       // The variable value is in the Scalar value inside the m_value. We can
       // point our m_data right to it.
-      m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+      m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
       break;
 
     case Value::eValueTypeFileAddress:
@@ -209,7 +209,7 @@
           value.SetCompilerType(m_compiler_type);
         }
 
-        m_error = value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+        m_error = value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
       }
       break;
     }
Index: lldb/source/Core/ValueObjectDynamicValue.cpp
===================================================================
--- lldb/source/Core/ValueObjectDynamicValue.cpp
+++ lldb/source/Core/ValueObjectDynamicValue.cpp
@@ -199,7 +199,7 @@
     ClearDynamicTypeInformation();
     m_dynamic_type_info.Clear();
     m_value = m_parent->GetValue();
-    m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+    m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
     return m_error.Success();
   }
 
@@ -249,7 +249,7 @@
   if (m_address.IsValid() && m_dynamic_type_info) {
     // The variable value is in the Scalar value inside the m_value. We can
     // point our m_data right to it.
-    m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+    m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
     if (m_error.Success()) {
       if (!CanProvideValue()) {
         // this value object represents an aggregate type whose children have
Index: lldb/source/Core/ValueObjectConstResult.cpp
===================================================================
--- lldb/source/Core/ValueObjectConstResult.cpp
+++ lldb/source/Core/ValueObjectConstResult.cpp
@@ -182,7 +182,7 @@
   m_name = name;
   ExecutionContext exe_ctx;
   exe_scope->CalculateExecutionContext(exe_ctx);
-  m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, module);
+  m_error = m_value.GetValueAsData(&exe_ctx, m_data, module);
 }
 
 ValueObjectConstResult::~ValueObjectConstResult() {}
Index: lldb/source/Core/ValueObjectChild.cpp
===================================================================
--- lldb/source/Core/ValueObjectChild.cpp
+++ lldb/source/Core/ValueObjectChild.cpp
@@ -227,7 +227,7 @@
         if (GetCompilerType().GetTypeInfo() & lldb::eTypeHasValue) {
           Value &value = is_instance_ptr_base ? m_parent->GetValue() : m_value;
           m_error =
-              value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+              value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
         } else {
           m_error.Clear(); // No value so nothing to read...
         }
Index: lldb/source/Core/ValueObjectCast.cpp
===================================================================
--- lldb/source/Core/ValueObjectCast.cpp
+++ lldb/source/Core/ValueObjectCast.cpp
@@ -79,7 +79,7 @@
                         m_value.GetScalar() != old_value.GetScalar());
     }
     ExecutionContext exe_ctx(GetExecutionContextRef());
-    m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+    m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
     SetValueDidChange(m_parent->GetValueDidChange());
     return true;
   }
Index: lldb/source/Core/ValueObject.cpp
===================================================================
--- lldb/source/Core/ValueObject.cpp
+++ lldb/source/Core/ValueObject.cpp
@@ -811,7 +811,7 @@
 uint64_t ValueObject::GetData(DataExtractor &data, Status &error) {
   UpdateValueIfNeeded(false);
   ExecutionContext exe_ctx(GetExecutionContextRef());
-  error = m_value.GetValueAsData(&exe_ctx, data, 0, GetModule().get());
+  error = m_value.GetValueAsData(&exe_ctx, data, GetModule().get());
   if (error.Fail()) {
     if (m_data.GetByteSize()) {
       data = m_data;
@@ -2717,9 +2717,9 @@
 
     if (IsBitfield()) {
       Value v(Scalar(GetValueAsUnsigned(UINT64_MAX)));
-      m_error = v.GetValueAsData(&exe_ctx, data, 0, GetModule().get());
+      m_error = v.GetValueAsData(&exe_ctx, data, GetModule().get());
     } else
-      m_error = m_value.GetValueAsData(&exe_ctx, data, 0, GetModule().get());
+      m_error = m_value.GetValueAsData(&exe_ctx, data, GetModule().get());
 
     valobj_sp = ValueObjectConstResult::Create(
         exe_ctx.GetBestExecutionContextScope(), GetCompilerType(), name, data,
Index: lldb/source/Core/Value.cpp
===================================================================
--- lldb/source/Core/Value.cpp
+++ lldb/source/Core/Value.cpp
@@ -314,7 +314,7 @@
 }
 
 Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
-                             uint32_t data_offset, Module *module) {
+                             Module *module) {
   data.Clear();
 
   Status error;
@@ -520,13 +520,12 @@
 
   // Make sure we have enough room within "data", and if we don't make
   // something large enough that does
-  if (!data.ValidOffsetForDataOfSize(data_offset, byte_size)) {
-    auto data_sp =
-        std::make_shared<DataBufferHeap>(data_offset + byte_size, '\0');
+  if (!data.ValidOffsetForDataOfSize(0, byte_size)) {
+    auto data_sp = std::make_shared<DataBufferHeap>(byte_size, '\0');
     data.SetData(data_sp);
   }
 
-  uint8_t *dst = const_cast<uint8_t *>(data.PeekData(data_offset, byte_size));
+  uint8_t *dst = const_cast<uint8_t *>(data.PeekData(0, byte_size));
   if (dst != nullptr) {
     if (address_type == eAddressTypeHost) {
       // The address is an address in this process, so just copy it.
@@ -597,7 +596,7 @@
     {
       DataExtractor data;
       lldb::addr_t addr = m_value.ULongLong(LLDB_INVALID_ADDRESS);
-      Status error(GetValueAsData(exe_ctx, data, 0, nullptr));
+      Status error(GetValueAsData(exe_ctx, data, nullptr));
       if (error.Success()) {
         Scalar scalar;
         if (compiler_type.GetValueAsScalar(data, 0, data.GetByteSize(),
Index: lldb/include/lldb/Core/Value.h
===================================================================
--- lldb/include/lldb/Core/Value.h
+++ lldb/include/lldb/Core/Value.h
@@ -210,7 +210,6 @@
   uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx);
 
   Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
-                        uint32_t data_offset,
                         Module *module); // Can be nullptr
 
   static const char *GetValueTypeAsCString(ValueType context_type);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to