diff options
author | Enrico Granata <egranata@apple.com> | 2015-07-01 20:06:40 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2015-07-01 20:06:40 +0000 |
commit | d4cb1dddebe5a65672d62fe379956f7324749fa4 (patch) | |
tree | ae650fff9526e53fcb4d05b88026bbf2a34eae8c /lldb/source/DataFormatters/FormatManager.cpp | |
parent | ae94f11d55bdcea4a5dfaa32c52d2ba2c0bb7613 (diff) | |
download | bcm5719-llvm-d4cb1dddebe5a65672d62fe379956f7324749fa4.tar.gz bcm5719-llvm-d4cb1dddebe5a65672d62fe379956f7324749fa4.zip |
When I introduced hard-coded formatters, I made them non-cacheable
This is because - in theory - the formatter could match on not just the type, but also other properties of a ValueObject, so a per-type caching would not be a good thing
On the other hand, that is not always true - sometimes the matching truly is per-type
So, introduce a non-cacheable attribute on formatters that decides whether a formatter should or should not be cached. That way, the few formatters that don't want themselves cached can do so, but most formatters (including most hard-coded ones) can cache themselves just fine
llvm-svn: 241184
Diffstat (limited to 'lldb/source/DataFormatters/FormatManager.cpp')
-rw-r--r-- | lldb/source/DataFormatters/FormatManager.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index 5e0adcb28d1..47456ba5c45 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -662,7 +662,8 @@ FormatManager::GetFormat (ValueObject& valobj, log->Printf("[FormatManager::GetFormat] Search failed. Giving hardcoded a chance."); retval = GetHardcodedFormat(valobj, use_dynamic); } - else if (valobj_type) + + if (valobj_type && (!retval || !retval->NonCacheable())) { if (log) log->Printf("[FormatManager::GetFormat] Caching %p for type %s", @@ -719,7 +720,8 @@ FormatManager::GetSummaryFormat (ValueObject& valobj, log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving hardcoded a chance."); retval = GetHardcodedSummaryFormat(valobj, use_dynamic); } - else if (valobj_type) + + if (valobj_type && (!retval || !retval->NonCacheable())) { if (log) log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s", @@ -777,7 +779,8 @@ FormatManager::GetSyntheticChildren (ValueObject& valobj, log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving hardcoded a chance."); retval = GetHardcodedSyntheticChildren(valobj, use_dynamic); } - else if (valobj_type) + + if (valobj_type && (!retval || !retval->NonCacheable())) { if (log) log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s", @@ -822,7 +825,8 @@ FormatManager::GetValidator (ValueObject& valobj, log->Printf("[FormatManager::GetValidator] Search failed. Giving hardcoded a chance."); retval = GetHardcodedValidator(valobj, use_dynamic); } - else if (valobj_type) + + if (valobj_type && (!retval || !retval->NonCacheable())) { if (log) log->Printf("[FormatManager::GetValidator] Caching %p for type %s", @@ -1611,7 +1615,7 @@ FormatManager::LoadHardcodedFormatters() [](lldb_private::ValueObject& valobj, lldb::DynamicValueType, FormatManager& fmt_mgr) -> SyntheticChildren::SharedPointer { - static CXXSyntheticChildren::SharedPointer formatter_sp(new CXXSyntheticChildren(SyntheticChildren::Flags().SetCascades(true).SetSkipPointers(true).SetSkipReferences(true), + static CXXSyntheticChildren::SharedPointer formatter_sp(new CXXSyntheticChildren(SyntheticChildren::Flags().SetCascades(true).SetSkipPointers(true).SetSkipReferences(true).SetNonCacheable(true), "vector_type synthetic children", lldb_private::formatters::VectorTypeSyntheticFrontEndCreator)); if (valobj.GetClangType().IsVectorType(nullptr, nullptr)) |