[Lldb-commits] [PATCH] D12092: [ValueObjectSynthetic] Override GetDeclaration.

Siva Chandra via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 17 16:02:31 PDT 2015


sivachandra created this revision.
sivachandra added reviewers: clayborg, granata.enrico.
sivachandra added a subscriber: lldb-commits.

Returns the declaration of the non-sythetic value.

http://reviews.llvm.org/D12092

Files:
  include/lldb/Core/ValueObjectSyntheticFilter.h
  source/Core/ValueObjectSyntheticFilter.cpp
  test/python_api/formatters/TestFormattersSBAPI.py

Index: test/python_api/formatters/TestFormattersSBAPI.py
===================================================================
--- test/python_api/formatters/TestFormattersSBAPI.py
+++ test/python_api/formatters/TestFormattersSBAPI.py
@@ -169,6 +169,7 @@
 
         foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
         self.assertTrue(foo_var.IsValid(), 'could not find foo')
+        self.assertTrue(foo_var.GetDeclaration().IsValid(), 'foo declaration is invalid')
 
         self.assertTrue(foo_var.GetNumChildren() == 2, 'synthetic value has wrong number of child items (synth)')
         self.assertTrue(foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 1, 'foo_synth.X has wrong value (synth)')
Index: source/Core/ValueObjectSyntheticFilter.cpp
===================================================================
--- source/Core/ValueObjectSyntheticFilter.cpp
+++ source/Core/ValueObjectSyntheticFilter.cpp
@@ -314,3 +314,12 @@
     this->ValueObject::SetFormat(format);
     this->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
 }
+
+bool
+ValueObjectSynthetic::GetDeclaration (Declaration &decl)
+{
+    if (m_parent)
+        return m_parent->GetDeclaration(decl);
+
+    return ValueObject::GetDeclaration(decl);
+}
Index: include/lldb/Core/ValueObjectSyntheticFilter.h
===================================================================
--- include/lldb/Core/ValueObjectSyntheticFilter.h
+++ include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -152,6 +152,9 @@
     virtual void
     SetFormat (lldb::Format format);
     
+    virtual bool
+    GetDeclaration (Declaration &decl);
+
 protected:
     virtual bool
     UpdateValue ();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12092.32350.patch
Type: text/x-patch
Size: 1725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150817/a3b42cb2/attachment.bin>


More information about the lldb-commits mailing list