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

Siva Chandra via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 17 17:55:09 PDT 2015


sivachandra updated this revision to Diff 32362.
sivachandra added a comment.

Override GetDeclaration in ValueObjectDynamicValue as well.


http://reviews.llvm.org/D12092

Files:
  include/lldb/Core/ValueObjectDynamicValue.h
  include/lldb/Core/ValueObjectSyntheticFilter.h
  source/Core/ValueObjectDynamicValue.cpp
  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: source/Core/ValueObjectDynamicValue.cpp
===================================================================
--- source/Core/ValueObjectDynamicValue.cpp
+++ source/Core/ValueObjectDynamicValue.cpp
@@ -421,3 +421,12 @@
     SetNeedsUpdate();
     return ret_val;
 }
+
+bool
+ValueObjectDynamicValue::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 ();
Index: include/lldb/Core/ValueObjectDynamicValue.h
===================================================================
--- include/lldb/Core/ValueObjectDynamicValue.h
+++ include/lldb/Core/ValueObjectDynamicValue.h
@@ -85,7 +85,7 @@
     {
         return m_parent->GetSP();
     }
-    
+
     void
     SetOwningSP (lldb::ValueObjectSP &owning_sp)
     {
@@ -105,6 +105,9 @@
     virtual TypeImpl
     GetTypeImpl ();
     
+    virtual bool
+    GetDeclaration (Declaration &decl);
+
 protected:
     virtual bool
     UpdateValue ();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12092.32362.patch
Type: text/x-patch
Size: 2725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150818/46fc63a1/attachment.bin>


More information about the lldb-commits mailing list