aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategoryMap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/DataFormatters/TypeCategoryMap.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/TypeCategoryMap.cpp105
1 files changed, 72 insertions, 33 deletions
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategoryMap.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategoryMap.cpp
index 96b9e6df8a47..58e4e2117bb6 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategoryMap.cpp
+++ b/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategoryMap.cpp
@@ -9,8 +9,8 @@
#include "lldb/DataFormatters/TypeCategoryMap.h"
+#include "lldb/Core/Log.h"
#include "lldb/DataFormatters/FormatClasses.h"
-#include "lldb/DataFormatters/FormatManager.h"
// C Includes
// C++ Includes
@@ -218,25 +218,35 @@ TypeCategoryMap::AnyMatches (ConstString type_name,
}
lldb::TypeFormatImplSP
-TypeCategoryMap::GetFormat (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
+TypeCategoryMap::GetFormat (FormattersMatchData& match_data)
{
Mutex::Locker locker(m_map_mutex);
uint32_t reason_why;
ActiveCategoriesIterator begin, end = m_active_categories.end();
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-
- FormattersMatchVector matches = FormatManager::GetPossibleMatches(valobj, use_dynamic);
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
+ if (log)
+ {
+ for (auto match : match_data.GetMatchesVector())
+ {
+ log->Printf("[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s reason = %" PRIu32,
+ match.GetTypeName().GetCString(),
+ match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
+ match.DidStripReference() ? "strip-reference" : "no-strip-reference",
+ match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
+ match.GetReason());
+ }
+ }
+
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::TypeCategoryImplSP category_sp = *begin;
lldb::TypeFormatImplSP current_format;
if (log)
- log->Printf("\n[TypeCategoryMap::GetFormat] Trying to use category %s", category_sp->GetName());
- if (!category_sp->Get(valobj, matches, current_format, &reason_why))
+ log->Printf("[TypeCategoryMap::GetFormat] Trying to use category %s", category_sp->GetName());
+ if (!category_sp->Get(match_data.GetValueObject(), match_data.GetMatchesVector(), current_format, &reason_why))
continue;
return current_format;
}
@@ -246,25 +256,35 @@ TypeCategoryMap::GetFormat (ValueObject& valobj,
}
lldb::TypeSummaryImplSP
-TypeCategoryMap::GetSummaryFormat (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
+TypeCategoryMap::GetSummaryFormat (FormattersMatchData& match_data)
{
Mutex::Locker locker(m_map_mutex);
uint32_t reason_why;
ActiveCategoriesIterator begin, end = m_active_categories.end();
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-
- FormattersMatchVector matches = FormatManager::GetPossibleMatches(valobj, use_dynamic);
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
+ if (log)
+ {
+ for (auto match : match_data.GetMatchesVector())
+ {
+ log->Printf("[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s reason = %" PRIu32,
+ match.GetTypeName().GetCString(),
+ match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
+ match.DidStripReference() ? "strip-reference" : "no-strip-reference",
+ match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
+ match.GetReason());
+ }
+ }
+
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::TypeCategoryImplSP category_sp = *begin;
lldb::TypeSummaryImplSP current_format;
if (log)
- log->Printf("\n[CategoryMap::GetSummaryFormat] Trying to use category %s", category_sp->GetName());
- if (!category_sp->Get(valobj, matches, current_format, &reason_why))
+ log->Printf("[CategoryMap::GetSummaryFormat] Trying to use category %s", category_sp->GetName());
+ if (!category_sp->Get(match_data.GetValueObject(), match_data.GetMatchesVector(), current_format, &reason_why))
continue;
return current_format;
}
@@ -275,8 +295,7 @@ TypeCategoryMap::GetSummaryFormat (ValueObject& valobj,
#ifndef LLDB_DISABLE_PYTHON
lldb::SyntheticChildrenSP
-TypeCategoryMap::GetSyntheticChildren (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
+TypeCategoryMap::GetSyntheticChildren (FormattersMatchData& match_data)
{
Mutex::Locker locker(m_map_mutex);
@@ -284,17 +303,28 @@ TypeCategoryMap::GetSyntheticChildren (ValueObject& valobj,
ActiveCategoriesIterator begin, end = m_active_categories.end();
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-
- FormattersMatchVector matches = FormatManager::GetPossibleMatches(valobj, use_dynamic);
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
+ if (log)
+ {
+ for (auto match : match_data.GetMatchesVector())
+ {
+ log->Printf("[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s reason = %" PRIu32,
+ match.GetTypeName().GetCString(),
+ match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
+ match.DidStripReference() ? "strip-reference" : "no-strip-reference",
+ match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
+ match.GetReason());
+ }
+ }
+
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::TypeCategoryImplSP category_sp = *begin;
lldb::SyntheticChildrenSP current_format;
if (log)
- log->Printf("\n[CategoryMap::GetSyntheticChildren] Trying to use category %s", category_sp->GetName());
- if (!category_sp->Get(valobj, matches, current_format, &reason_why))
+ log->Printf("[CategoryMap::GetSyntheticChildren] Trying to use category %s", category_sp->GetName());
+ if (!category_sp->Get(match_data.GetValueObject(), match_data.GetMatchesVector(), current_format, &reason_why))
continue;
return current_format;
}
@@ -305,25 +335,35 @@ TypeCategoryMap::GetSyntheticChildren (ValueObject& valobj,
#endif
lldb::TypeValidatorImplSP
-TypeCategoryMap::GetValidator (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
+TypeCategoryMap::GetValidator (FormattersMatchData& match_data)
{
Mutex::Locker locker(m_map_mutex);
uint32_t reason_why;
ActiveCategoriesIterator begin, end = m_active_categories.end();
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-
- FormattersMatchVector matches = FormatManager::GetPossibleMatches(valobj, use_dynamic);
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
+ if (log)
+ {
+ for (auto match : match_data.GetMatchesVector())
+ {
+ log->Printf("[CategoryMap::GetValidator] candidate match = %s %s %s %s reason = %" PRIu32,
+ match.GetTypeName().GetCString(),
+ match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
+ match.DidStripReference() ? "strip-reference" : "no-strip-reference",
+ match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
+ match.GetReason());
+ }
+ }
+
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::TypeCategoryImplSP category_sp = *begin;
lldb::TypeValidatorImplSP current_format;
if (log)
- log->Printf("\n[CategoryMap::GetValidator] Trying to use category %s", category_sp->GetName());
- if (!category_sp->Get(valobj, matches, current_format, &reason_why))
+ log->Printf("[CategoryMap::GetValidator] Trying to use category %s", category_sp->GetName());
+ if (!category_sp->Get(match_data.GetValueObject(), match_data.GetMatchesVector(), current_format, &reason_why))
continue;
return current_format;
}
@@ -333,7 +373,7 @@ TypeCategoryMap::GetValidator (ValueObject& valobj,
}
void
-TypeCategoryMap::LoopThrough(CallbackType callback, void* param)
+TypeCategoryMap::ForEach(ForEachCallback callback)
{
if (callback)
{
@@ -345,8 +385,7 @@ TypeCategoryMap::LoopThrough(CallbackType callback, void* param)
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::TypeCategoryImplSP category = *begin;
- ConstString type = ConstString(category->GetName());
- if (!callback(param, category))
+ if (!callback(category))
break;
}
}
@@ -359,7 +398,7 @@ TypeCategoryMap::LoopThrough(CallbackType callback, void* param)
if (pos->second->IsEnabled())
continue;
KeyType type = pos->first;
- if (!callback(param, pos->second))
+ if (!callback(pos->second))
break;
}
}