[Lldb-commits] [lldb] r245319 - [ValueObjectSynthetic and ValueObjectDynamicValue] Override GetDeclaration
Siva Chandra via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 18 10:56:06 PDT 2015
Author: sivachandra
Date: Tue Aug 18 12:56:06 2015
New Revision: 245319
URL: http://llvm.org/viewvc/llvm-project?rev=245319&view=rev
Log:
[ValueObjectSynthetic and ValueObjectDynamicValue] Override GetDeclaration
Summary:
Returns the declaration of the parent (non-synthetic or static) value.
Reviewers: granata.enrico, clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12092
Modified:
lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
lldb/trunk/test/python_api/formatters/TestFormattersSBAPI.py
Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=245319&r1=245318&r2=245319&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Tue Aug 18 12:56:06 2015
@@ -85,7 +85,7 @@ public:
{
return m_parent->GetSP();
}
-
+
void
SetOwningSP (lldb::ValueObjectSP &owning_sp)
{
@@ -105,6 +105,9 @@ public:
virtual TypeImpl
GetTypeImpl ();
+ virtual bool
+ GetDeclaration (Declaration &decl);
+
protected:
virtual bool
UpdateValue ();
Modified: lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h?rev=245319&r1=245318&r2=245319&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h Tue Aug 18 12:56:06 2015
@@ -152,6 +152,9 @@ public:
virtual void
SetFormat (lldb::Format format);
+ virtual bool
+ GetDeclaration (Declaration &decl);
+
protected:
virtual bool
UpdateValue ();
Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=245319&r1=245318&r2=245319&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Tue Aug 18 12:56:06 2015
@@ -421,3 +421,12 @@ ValueObjectDynamicValue::SetData (DataEx
SetNeedsUpdate();
return ret_val;
}
+
+bool
+ValueObjectDynamicValue::GetDeclaration (Declaration &decl)
+{
+ if (m_parent)
+ return m_parent->GetDeclaration(decl);
+
+ return ValueObject::GetDeclaration(decl);
+}
Modified: lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp?rev=245319&r1=245318&r2=245319&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp Tue Aug 18 12:56:06 2015
@@ -314,3 +314,12 @@ ValueObjectSynthetic::SetFormat (lldb::F
this->ValueObject::SetFormat(format);
this->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
}
+
+bool
+ValueObjectSynthetic::GetDeclaration (Declaration &decl)
+{
+ if (m_parent)
+ return m_parent->GetDeclaration(decl);
+
+ return ValueObject::GetDeclaration(decl);
+}
Modified: lldb/trunk/test/python_api/formatters/TestFormattersSBAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/formatters/TestFormattersSBAPI.py?rev=245319&r1=245318&r2=245319&view=diff
==============================================================================
--- lldb/trunk/test/python_api/formatters/TestFormattersSBAPI.py (original)
+++ lldb/trunk/test/python_api/formatters/TestFormattersSBAPI.py Tue Aug 18 12:56:06 2015
@@ -169,6 +169,7 @@ class SBFormattersAPITestCase(TestBase):
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)')
More information about the lldb-commits
mailing list