[LLDB] Change RegisterValue::SetType param to const RegisterInfo&
authorDavid Spickett <david.spickett@linaro.org>
Wed, 28 Sep 2022 14:52:12 +0000 (14:52 +0000)
committerDavid Spickett <david.spickett@linaro.org>
Wed, 12 Oct 2022 08:25:14 +0000 (08:25 +0000)
No one was pasing nullptr here.

Depends on D135670

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D135671

lldb/include/lldb/Utility/RegisterValue.h
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
lldb/source/Utility/RegisterValue.cpp

index 3a3c0a0..ff3dc9b 100644 (file)
@@ -84,7 +84,7 @@ public:
 
   void SetType(RegisterValue::Type type) { m_type = type; }
 
-  RegisterValue::Type SetType(const RegisterInfo *reg_info);
+  RegisterValue::Type SetType(const RegisterInfo &reg_info);
 
   bool GetData(DataExtractor &data) const;
 
index 146e33f..9af795f 100644 (file)
@@ -75,7 +75,7 @@ NativeRegisterContextLinux::WriteRegisterRaw(uint32_t reg_index,
         memcpy(dst + (reg_info->byte_offset & 0x1), src, src_size);
         // Set this full register as the value to write.
         value_to_write.SetBytes(dst, full_value.GetByteSize(), byte_order);
-        value_to_write.SetType(full_reg_info);
+        value_to_write.SetType(*full_reg_info);
         reg_to_write = full_reg;
       }
     }
index 8d4585a..5ad2f7a 100644 (file)
@@ -136,7 +136,7 @@ NativeRegisterContextLinux_arm::ReadRegister(const RegisterInfo *reg_info,
       // then use the type specified by reg_info rather than the uint64_t
       // default
       if (reg_value.GetByteSize() > reg_info->byte_size)
-        reg_value.SetType(reg_info);
+        reg_value.SetType(*reg_info);
     }
     return error;
   }
index f1d37b0..b9ce9fd 100644 (file)
@@ -149,13 +149,12 @@ bool RegisterValue::GetScalarValue(Scalar &scalar) const {
 
 void RegisterValue::Clear() { m_type = eTypeInvalid; }
 
-RegisterValue::Type RegisterValue::SetType(const RegisterInfo *reg_info) {
-  assert(reg_info && "Expected non null reg_info.");
+RegisterValue::Type RegisterValue::SetType(const RegisterInfo &reg_info) {
   // To change the type, we simply copy the data in again, using the new format
   RegisterValue copy;
   DataExtractor copy_data;
   if (copy.CopyValue(*this) && copy.GetData(copy_data)) {
-    Status error = SetValueFromData(*reg_info, copy_data, 0, true);
+    Status error = SetValueFromData(reg_info, copy_data, 0, true);
     assert(error.Success() && "Expected SetValueFromData to succeed.");
     UNUSED_IF_ASSERT_DISABLED(error);
   }