[Core] Use the implementation method GetAddressOf in ValueObjectConstResultChild
authorAleksandr Urakov <aleksandr.urakov@jetbrains.com>
Mon, 14 Jan 2019 13:08:13 +0000 (13:08 +0000)
committerAleksandr Urakov <aleksandr.urakov@jetbrains.com>
Mon, 14 Jan 2019 13:08:13 +0000 (13:08 +0000)
Summary:
This patch allows to retrieve an address object for `ValueObject`'s children
retrieved through e.g. `GetChildAtIndex` or `GetChildMemberWithName`. It just
uses the corresponding method of the implementation object `m_impl` to achieve
that.

Reviewers: zturner, JDevlieghere, clayborg, labath, serge-sans-paille

Reviewed By: clayborg

Subscribers: leonid.mashinskiy, lldb-commits

Tags: #lldb

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

llvm-svn: 351065

lldb/include/lldb/Core/ValueObjectConstResultChild.h
lldb/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
lldb/source/Core/ValueObjectConstResultChild.cpp

index 9ff62d1..f14fb75 100644 (file)
@@ -63,6 +63,9 @@ public:
 
   lldb::ValueObjectSP AddressOf(Status &error) override;
 
+  lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
+                            AddressType *address_type = nullptr) override;
+
   size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
                         uint32_t item_count = 1) override;
 
index 8a4af0c..2299f1f 100644 (file)
@@ -153,6 +153,9 @@ class ValueAPITestCase(TestBase):
         val_s = target.EvaluateExpression('s')
         val_a = target.EvaluateExpression('a')
         self.assertTrue(
+            val_s.GetChildMemberWithName('a').GetAddress().IsValid(),
+            VALID_VARIABLE)
+        self.assertTrue(
             val_s.GetChildMemberWithName('a').AddressOf(),
             VALID_VARIABLE)
         self.assertTrue(
index bbfbd8e..441c164 100644 (file)
@@ -52,6 +52,11 @@ lldb::ValueObjectSP ValueObjectConstResultChild::AddressOf(Status &error) {
   return m_impl.AddressOf(error);
 }
 
+lldb::addr_t ValueObjectConstResultChild::GetAddressOf(
+  bool scalar_is_load_address, AddressType* address_type) {
+  return m_impl.GetAddressOf(scalar_is_load_address, address_type);
+}
+
 ValueObject *ValueObjectConstResultChild::CreateChildAtIndex(
     size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
   return m_impl.CreateChildAtIndex(idx, synthetic_array_member,