The existing logic to loop over formatters is very pre-C++11, using void* batons, and function pointers, and raw memory allocations instead of safer more modern constructs
This is a first pass at a cleanup of that code, modernizing the "type X clear" commands, and providing the basic infrastructure I plan to use all over
More cleanup will come over the next few days
llvm-svn: 253125
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 2362ba5..3237f73 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -500,6 +500,21 @@
}
}
+void
+FormatManager::ForEachCategory(TypeCategoryMap::ForEachCallback callback)
+{
+ m_categories_map.ForEach(callback);
+ Mutex::Locker locker(m_language_categories_mutex);
+ for (const auto& entry : m_language_categories_map)
+ {
+ if (auto category_sp = entry.second->GetCategory())
+ {
+ if (!callback(category_sp))
+ break;
+ }
+ }
+}
+
lldb::TypeCategoryImplSP
FormatManager::GetCategory (const ConstString& category_name,
bool can_create)