diff options
author | Enrico Granata <egranata@apple.com> | 2015-03-06 19:37:57 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2015-03-06 19:37:57 +0000 |
commit | db595cdc17a7d5c0b9d588a729cb6a6a2ceb6e55 (patch) | |
tree | 7c4961ca5df281e5730fb0518261bbbecc6a2fff /lldb/source/DataFormatters/FormatManager.cpp | |
parent | e8a64a20f2774e6959ea1333b9b7d0048fab8eb9 (diff) | |
download | llvm-db595cdc17a7d5c0b9d588a729cb6a6a2ceb6e55.zip llvm-db595cdc17a7d5c0b9d588a729cb6a6a2ceb6e55.tar.gz llvm-db595cdc17a7d5c0b9d588a729cb6a6a2ceb6e55.tar.bz2 |
A few improvements to our vector types formatting story:
- use a hardcoded formatter to match all vector types, and make it so that their element type is taken into account when doing default formatting
- special case a vector of char to display byte values instead of characters by default
Fixes the test failures Ilia was seeing
llvm-svn: 231504
Diffstat (limited to 'lldb/source/DataFormatters/FormatManager.cpp')
-rw-r--r-- | lldb/source/DataFormatters/FormatManager.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index c94ad34..01dc8fa 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -477,7 +477,7 @@ FormatManager::GetValidatorForType (lldb::TypeNameSpecifierImplSP type_sp) lldb::TypeCategoryImplSP FormatManager::GetCategory (const ConstString& category_name, - bool can_create) + bool can_create) { if (!category_name) return GetCategory(m_default_category_name); @@ -1215,16 +1215,6 @@ FormatManager::LoadSystemFormatters() fourchar_flags.SetCascades(true).SetSkipPointers(true).SetSkipReferences(true); AddFormat(sys_category_sp, lldb::eFormatOSType, ConstString("FourCharCode"), fourchar_flags); - - SyntheticChildren::Flags synth_flags; - synth_flags.SetCascades(true).SetSkipPointers(true).SetSkipReferences(true); - - AddCXXSynthetic(sys_category_sp, - lldb_private::formatters::VectorTypeSyntheticFrontEndCreator, - "vector_type synthetic children", - ConstString("unsigned char __attribute__\\(\\(ext_vector_type\\([0-9]+\\)\\)\\)"), - synth_flags, - true); #endif } @@ -1615,6 +1605,20 @@ FormatManager::LoadHardcodedFormatters() } { // insert code to load synthetics here + m_hardcoded_synthetics.push_back( + [](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), + "vector_type synthetic children", + lldb_private::formatters::VectorTypeSyntheticFrontEndCreator)); + if (valobj.GetClangType().IsVectorType(nullptr, nullptr)) + { + if (fmt_mgr.GetCategory(fmt_mgr.m_vectortypes_category_name)->IsEnabled()) + return formatter_sp; + } + return nullptr; + }); } { // insert code to load validators here |