llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Miro Bucko (mbucko)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/95997.diff


2 Files Affected:

- (modified) lldb/source/API/SBAddressRange.cpp (+3-15) 
- (modified) lldb/test/API/python_api/address_range/TestAddressRange.py (+1-1) 


``````````diff
diff --git a/lldb/source/API/SBAddressRange.cpp 
b/lldb/source/API/SBAddressRange.cpp
index 9b1affdade439..0fba252979093 100644
--- a/lldb/source/API/SBAddressRange.cpp
+++ b/lldb/source/API/SBAddressRange.cpp
@@ -50,8 +50,6 @@ const SBAddressRange &SBAddressRange::operator=(const 
SBAddressRange &rhs) {
 bool SBAddressRange::operator==(const SBAddressRange &rhs) {
   LLDB_INSTRUMENT_VA(this, rhs);
 
-  if (!IsValid() || !rhs.IsValid())
-    return false;
   return m_opaque_up->operator==(*(rhs.m_opaque_up));
 }
 
@@ -64,28 +62,24 @@ bool SBAddressRange::operator!=(const SBAddressRange &rhs) {
 void SBAddressRange::Clear() {
   LLDB_INSTRUMENT_VA(this);
 
-  m_opaque_up.reset();
+  m_opaque_up->Clear();
 }
 
 bool SBAddressRange::IsValid() const {
   LLDB_INSTRUMENT_VA(this);
 
-  return m_opaque_up && m_opaque_up->IsValid();
+  return m_opaque_up->IsValid();
 }
 
 lldb::SBAddress SBAddressRange::GetBaseAddress() const {
   LLDB_INSTRUMENT_VA(this);
 
-  if (!IsValid())
-    return lldb::SBAddress();
   return lldb::SBAddress(m_opaque_up->GetBaseAddress());
 }
 
 lldb::addr_t SBAddressRange::GetByteSize() const {
   LLDB_INSTRUMENT_VA(this);
 
-  if (!IsValid())
-    return 0;
   return m_opaque_up->GetByteSize();
 }
 
@@ -93,11 +87,5 @@ bool SBAddressRange::GetDescription(SBStream &description,
                                     const SBTarget target) {
   LLDB_INSTRUMENT_VA(this, description, target);
 
-  Stream &stream = description.ref();
-  if (!IsValid()) {
-    stream << "<invalid>";
-    return true;
-  }
-  m_opaque_up->GetDescription(&stream, target.GetSP().get());
-  return true;
+  return m_opaque_up->GetDescription(&description.ref(), target.GetSP().get());
 }
diff --git a/lldb/test/API/python_api/address_range/TestAddressRange.py 
b/lldb/test/API/python_api/address_range/TestAddressRange.py
index 86ca4a62155f0..ae4b8c7c90ce4 100644
--- a/lldb/test/API/python_api/address_range/TestAddressRange.py
+++ b/lldb/test/API/python_api/address_range/TestAddressRange.py
@@ -166,7 +166,7 @@ def test_address_range_list_iterator(self):
     def test_address_range_print_invalid(self):
         """Make sure the SBAddressRange can be printed when invalid."""
         range = lldb.SBAddressRange()
-        self.assertEqual(str(range), "<invalid>")
+        self.assertEqual(str(range), "[0xffffffffffffffff-0xffffffffffffffff)")
 
     def test_address_range_print_resolved(self):
         """Make sure the SBAddressRange can be printed when resolved."""

``````````

</details>


https://github.com/llvm/llvm-project/pull/95997
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to