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 ();


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 ();
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to