summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2015-05-07 20:33:31 +0000
committerEnrico Granata <egranata@apple.com>2015-05-07 20:33:31 +0000
commit4878c87d5ea9fbe40c465f8b9cee01a6e333be88 (patch)
tree0676c6fb6dad5a6273c3b2e5d8d1d99e5c1ed59f
parentaed94a0bbaec434b8679adb16ade99f45d2b6e0a (diff)
downloadbcm5719-llvm-4878c87d5ea9fbe40c465f8b9cee01a6e333be88.tar.gz
bcm5719-llvm-4878c87d5ea9fbe40c465f8b9cee01a6e333be88.zip
Make it so that changing formats on a synthetic value object causes children to be invalidated and refetched when needed
This is required for supporting vector types formatting llvm-svn: 236769
-rw-r--r--lldb/include/lldb/Core/ValueObject.h1
-rw-r--r--lldb/include/lldb/Core/ValueObjectSyntheticFilter.h7
-rw-r--r--lldb/source/Core/ValueObjectSyntheticFilter.cpp12
-rw-r--r--lldb/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py9
4 files changed, 23 insertions, 6 deletions
diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h
index afe6587b66f..f952acec3bf 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -1133,6 +1133,7 @@ protected:
friend class ClangExpressionVariable; // For SetName
friend class Target; // For SetName
friend class ValueObjectConstResultImpl;
+ friend class ValueObjectSynthetic; // For ClearUserVisibleData
//------------------------------------------------------------------
// Constructors and Destructors
diff --git a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
index f37096a0849..79c1e458af8 100644
--- a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -144,12 +144,7 @@ public:
SetValueFromCString (const char *value_str, Error& error);
virtual void
- SetFormat (lldb::Format format)
- {
- if (m_parent)
- m_parent->SetFormat(format);
- this->ValueObject::SetFormat(format);
- }
+ SetFormat (lldb::Format format);
protected:
virtual bool
diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
index e266267981b..c7cdce0ec6f 100644
--- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp
+++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
@@ -304,3 +304,15 @@ ValueObjectSynthetic::SetValueFromCString (const char *value_str, Error& error)
{
return m_parent->SetValueFromCString(value_str, error);
}
+
+void
+ValueObjectSynthetic::SetFormat (lldb::Format format)
+{
+ if (m_parent)
+ {
+ m_parent->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
+ m_parent->SetFormat(format);
+ }
+ this->ValueObject::SetFormat(format);
+ this->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
+}
diff --git a/lldb/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py b/lldb/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
index 3def101c608..3bd2262f601 100644
--- a/lldb/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
+++ b/lldb/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
@@ -71,6 +71,15 @@ class VectorTypesFormattingTestCase(TestBase):
self.expect("expr -f int16_t[] -- v", substrs=['[0] = 0', '[1] = 16288', '[2] = 0', '[3] = 16288', '[4] = 0', '[5] = 16416', '[6] = 0', '[7] = 16416'])
self.expect("expr -f uint128_t[] -- v", substrs=['[0] = 85236745249553456609335044694184296448'])
+
+ oldValue = v.GetChildAtIndex(0).GetValue()
+ v.SetFormat(lldb.eFormatHex)
+ newValue = v.GetChildAtIndex(0).GetValue()
+ self.assertFalse(oldValue == newValue, "values did not change along with format")
+
+ v.SetFormat(lldb.eFormatVectorOfFloat32)
+ oldValueAgain = v.GetChildAtIndex(0).GetValue()
+ self.assertTrue(oldValue == oldValueAgain, "same format but different values")
if __name__ == '__main__':
import atexit
OpenPOWER on IntegriCloud