summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2015-11-14 05:44:23 +0000
committerEnrico Granata <egranata@apple.com>2015-11-14 05:44:23 +0000
commitb56d01033e524cbf3e6281282cf21950499c3d7f (patch)
tree7e0623d4f97252d07a8898ec094485fa96abf1c6 /lldb/source/Commands
parentbd9fc28444c256bd1ed1e29a59bd938160c60674 (diff)
downloadbcm5719-llvm-b56d01033e524cbf3e6281282cf21950499c3d7f.tar.gz
bcm5719-llvm-b56d01033e524cbf3e6281282cf21950499c3d7f.zip
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
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandObjectType.cpp74
1 files changed, 26 insertions, 48 deletions
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index 022b326120e..6dba43d456e 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -1156,14 +1156,6 @@ private:
return &m_options;
}
- static bool
- PerCategoryCallback(void* param,
- const lldb::TypeCategoryImplSP& cate)
- {
- cate->Clear(eFormatCategoryItemValue | eFormatCategoryItemRegexValue);
- return true;
- }
-
public:
CommandObjectTypeFormatClear (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
@@ -1183,8 +1175,12 @@ protected:
DoExecute (Args& command, CommandReturnObject &result) override
{
if (m_options.m_delete_all)
- DataVisualization::Categories::LoopThrough(PerCategoryCallback, NULL);
-
+ {
+ DataVisualization::Categories::ForEach( [] (const TypeCategoryImplSP& category_sp) -> bool {
+ category_sp->Clear(eFormatCategoryItemValue | eFormatCategoryItemRegexValue);
+ return true;
+ });
+ }
else
{
lldb::TypeCategoryImplSP category;
@@ -2188,16 +2184,6 @@ private:
return &m_options;
}
- static bool
- PerCategoryCallback(void* param,
- const lldb::TypeCategoryImplSP& cate)
- {
- cate->GetTypeSummariesContainer()->Clear();
- cate->GetRegexTypeSummariesContainer()->Clear();
- return true;
-
- }
-
public:
CommandObjectTypeSummaryClear (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
@@ -2218,8 +2204,12 @@ protected:
{
if (m_options.m_delete_all)
- DataVisualization::Categories::LoopThrough(PerCategoryCallback, NULL);
-
+ {
+ DataVisualization::Categories::ForEach( [] (const TypeCategoryImplSP& category_sp) -> bool {
+ category_sp->Clear(eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
+ return true;
+ });
+ }
else
{
lldb::TypeCategoryImplSP category;
@@ -3931,15 +3921,6 @@ private:
return &m_options;
}
- static bool
- PerCategoryCallback(void* param,
- const lldb::TypeCategoryImplSP& cate)
- {
- cate->Clear(eFormatCategoryItemFilter | eFormatCategoryItemRegexFilter);
- return true;
-
- }
-
public:
CommandObjectTypeFilterClear (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
@@ -3960,8 +3941,12 @@ protected:
{
if (m_options.m_delete_all)
- DataVisualization::Categories::LoopThrough(PerCategoryCallback, NULL);
-
+ {
+ DataVisualization::Categories::ForEach( [] (const TypeCategoryImplSP& category_sp) -> bool {
+ category_sp->Clear(eFormatCategoryItemFilter | eFormatCategoryItemRegexFilter);
+ return true;
+ });
+ }
else
{
lldb::TypeCategoryImplSP category;
@@ -3973,8 +3958,7 @@ protected:
}
else
DataVisualization::Categories::GetCategory(ConstString(NULL), category);
- category->GetTypeFiltersContainer()->Clear();
- category->GetRegexTypeFiltersContainer()->Clear();
+ category->Clear(eFormatCategoryItemFilter | eFormatCategoryItemRegexFilter);
}
result.SetStatus(eReturnStatusSuccessFinishResult);
@@ -4059,15 +4043,6 @@ private:
return &m_options;
}
- static bool
- PerCategoryCallback(void* param,
- const lldb::TypeCategoryImplSP& cate)
- {
- cate->Clear(eFormatCategoryItemSynth | eFormatCategoryItemRegexSynth);
- return true;
-
- }
-
public:
CommandObjectTypeSynthClear (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
@@ -4088,8 +4063,12 @@ protected:
{
if (m_options.m_delete_all)
- DataVisualization::Categories::LoopThrough(PerCategoryCallback, NULL);
-
+ {
+ DataVisualization::Categories::ForEach( [] (const TypeCategoryImplSP& category_sp) -> bool {
+ category_sp->Clear(eFormatCategoryItemSynth | eFormatCategoryItemRegexSynth);
+ return true;
+ });
+ }
else
{
lldb::TypeCategoryImplSP category;
@@ -4101,8 +4080,7 @@ protected:
}
else
DataVisualization::Categories::GetCategory(ConstString(NULL), category);
- category->GetTypeSyntheticsContainer()->Clear();
- category->GetRegexTypeSyntheticsContainer()->Clear();
+ category->Clear(eFormatCategoryItemSynth | eFormatCategoryItemRegexSynth);
}
result.SetStatus(eReturnStatusSuccessFinishResult);
OpenPOWER on IntegriCloud