sc = std::make_shared<Subcontainer>(change_listener);
}
- /// Returns the subcontainer containing formatters for exact matching.
- std::shared_ptr<Subcontainer> GetExactMatch() const {
- return m_subcontainers[lldb::eFormatterMatchExact];
- }
-
- /// Returns the subcontainer containing formatters for regex matching.
- std::shared_ptr<Subcontainer> GetRegexMatch() const {
- return m_subcontainers[lldb::eFormatterMatchRegex];
+ /// Clears all subcontainers.
+ void Clear() {
+ for (auto sc : m_subcontainers)
+ sc->Clear();
}
/// Adds a formatter to the right subcontainer depending on the matching type
TypeMatcher(type_sp));
}
+ /// Deletes all formatters registered with the string `name`, in all
+ /// subcontainers.
+ bool Delete(ConstString name) {
+ bool success = false;
+ for (auto sc : m_subcontainers)
+ success = sc->Delete(name) || success;
+ return success;
+ }
+
/// Returns the total count of elements across all subcontainers.
uint32_t GetCount() {
uint32_t result = 0;
return false;
}
+ bool AnyMatches(ConstString type_name) {
+ std::shared_ptr<FormatterImpl> entry;
+ for (auto sc : m_subcontainers) {
+ if (sc->Get(type_name, entry))
+ return true;
+ }
+ return false;
+ }
+
/// Returns a formatter that is an exact match for `type_specifier_sp`. It
/// looks for a formatter with the same matching type that was created from
/// the same string. This is useful so we can refer to a formatter using the
}
}
+ void AutoComplete(CompletionRequest &request) {
+ for (auto sc: m_subcontainers)
+ sc->AutoComplete(request);
+ }
+
private:
std::array<std::shared_ptr<Subcontainer>, lldb::eLastFormatterMatchType + 1>
m_subcontainers;
m_synth_cont.ForEach(callback.callback);
}
- FormatContainer::SubcontainerSP GetTypeFormatsContainer() {
- return m_format_cont.GetExactMatch();
- }
-
- FormatContainer::SubcontainerSP GetRegexTypeFormatsContainer() {
- return m_format_cont.GetRegexMatch();
- }
-
- FormatContainer &GetFormatContainer() { return m_format_cont; }
-
- SummaryContainer::SubcontainerSP GetTypeSummariesContainer() {
- return m_summary_cont.GetExactMatch();
- }
-
- SummaryContainer::SubcontainerSP GetRegexTypeSummariesContainer() {
- return m_summary_cont.GetRegexMatch();
- }
-
- SummaryContainer &GetSummaryContainer() { return m_summary_cont; }
-
- FilterContainer::SubcontainerSP GetTypeFiltersContainer() {
- return m_filter_cont.GetExactMatch();
- }
-
- FilterContainer::SubcontainerSP GetRegexTypeFiltersContainer() {
- return m_filter_cont.GetRegexMatch();
- }
-
- FilterContainer &GetFilterContainer() { return m_filter_cont; }
-
FormatContainer::MapValueType
GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
m_format_cont.Add(type_sp, format_sp);
}
+ void AddTypeFormat(llvm::StringRef name, lldb::FormatterMatchType match_type,
+ lldb::TypeFormatImplSP format_sp) {
+ AddTypeFormat(
+ std::make_shared<lldb_private::TypeNameSpecifierImpl>(name, match_type),
+ format_sp);
+ }
+
void AddTypeSummary(lldb::TypeNameSpecifierImplSP type_sp,
lldb::TypeSummaryImplSP summary_sp) {
m_summary_cont.Add(type_sp, summary_sp);
}
+ void AddTypeSummary(llvm::StringRef name, lldb::FormatterMatchType match_type,
+ lldb::TypeSummaryImplSP summary_sp) {
+ AddTypeSummary(
+ std::make_shared<lldb_private::TypeNameSpecifierImpl>(name, match_type),
+ summary_sp);
+ }
+
void AddTypeFilter(lldb::TypeNameSpecifierImplSP type_sp,
lldb::TypeFilterImplSP filter_sp) {
m_filter_cont.Add(type_sp, filter_sp);
}
+ void AddTypeFilter(llvm::StringRef name, lldb::FormatterMatchType match_type,
+ lldb::TypeFilterImplSP filter_sp) {
+ AddTypeFilter(
+ std::make_shared<lldb_private::TypeNameSpecifierImpl>(name, match_type),
+ filter_sp);
+ }
+
void AddTypeSynthetic(lldb::TypeNameSpecifierImplSP type_sp,
lldb::SyntheticChildrenSP synth_sp) {
m_synth_cont.Add(type_sp, synth_sp);
}
+ void AddTypeSynthetic(llvm::StringRef name,
+ lldb::FormatterMatchType match_type,
+ lldb::SyntheticChildrenSP synth_sp) {
+ AddTypeSynthetic(
+ std::make_shared<lldb_private::TypeNameSpecifierImpl>(name, match_type),
+ synth_sp);
+ }
+
bool DeleteTypeFormat(lldb::TypeNameSpecifierImplSP type_sp) {
return m_format_cont.Delete(type_sp);
}
SynthContainer::MapValueType GetSyntheticAtIndex(size_t index);
- SynthContainer::SubcontainerSP GetTypeSyntheticsContainer() {
- return m_synth_cont.GetExactMatch();
- }
-
- SynthContainer::SubcontainerSP GetRegexTypeSyntheticsContainer() {
- return m_synth_cont.GetRegexMatch();
- }
-
- SynthContainer &GetSyntheticsContainer() { return m_synth_cont; }
-
-
bool IsEnabled() const { return m_enabled; }
uint32_t GetEnabledPosition() {
const char **matching_category = nullptr,
FormatCategoryItems *matching_type = nullptr);
+ void AutoComplete(CompletionRequest &request, FormatCategoryItems items);
+
typedef std::shared_ptr<TypeCategoryImpl> SharedPointer;
private:
return false;
}
- ConstString typeCS(arg_entry.ref());
+ FormatterMatchType match_type = eFormatterMatchExact;
if (m_command_options.m_regex) {
+ match_type = eFormatterMatchRegex;
RegularExpression typeRX(arg_entry.ref());
if (!typeRX.IsValid()) {
result.AppendError(
"regex format error (maybe this is not really a regex?)");
return false;
}
- category_sp->GetRegexTypeSummariesContainer()->Delete(typeCS);
- category_sp->GetRegexTypeFormatsContainer()->Add(std::move(typeRX),
- entry);
- } else
- category_sp->GetTypeFormatsContainer()->Add(std::move(typeCS), entry);
+ }
+ category_sp->AddTypeFormat(arg_entry.ref(), match_type, entry);
}
result.SetStatus(eReturnStatusSuccessFinishNoResult);
DataVisualization::Categories::ForEach(
[this, &request](const lldb::TypeCategoryImplSP &category_sp) {
- if (CHECK_FORMATTER_KIND_MASK(eFormatCategoryItemFormat)) {
- category_sp->GetTypeFormatsContainer()->AutoComplete(request);
- category_sp->GetRegexTypeFormatsContainer()->AutoComplete(request);
- }
-
- if (CHECK_FORMATTER_KIND_MASK(eFormatCategoryItemSummary)) {
- category_sp->GetTypeSummariesContainer()->AutoComplete(request);
- category_sp->GetRegexTypeSummariesContainer()->AutoComplete(
- request);
- }
-
- if (CHECK_FORMATTER_KIND_MASK(eFormatCategoryItemFilter)) {
- category_sp->GetTypeFiltersContainer()->AutoComplete(request);
- category_sp->GetRegexTypeFiltersContainer()->AutoComplete(request);
- }
-
- if (CHECK_FORMATTER_KIND_MASK(eFormatCategoryItemSynth)) {
- category_sp->GetTypeSyntheticsContainer()->AutoComplete(request);
- category_sp->GetRegexTypeSyntheticsContainer()->AutoComplete(
- request);
- }
+ category_sp->AutoComplete(request, m_formatter_kind_mask);
return true;
});
}
SummaryFormatType type,
std::string category_name,
Status *error) {
+
+ // Named summaries are a special case, they exist in their own map in the
+ // FormatManager, outside of any categories.
+ if (type == eNamedSummary) {
+ // system named summaries do not exist (yet?)
+ DataVisualization::NamedSummaryFormats::Add(type_name, entry);
+ return true;
+ }
+
lldb::TypeCategoryImplSP category;
DataVisualization::Categories::GetCategory(ConstString(category_name.c_str()),
category);
type = eRegexSummary;
}
+ FormatterMatchType match_type = eFormatterMatchExact;
if (type == eRegexSummary) {
+ match_type = eFormatterMatchRegex;
RegularExpression typeRX(type_name.GetStringRef());
if (!typeRX.IsValid()) {
if (error)
"regex format error (maybe this is not really a regex?)");
return false;
}
-
- category->GetRegexTypeSummariesContainer()->Delete(type_name);
- category->GetRegexTypeSummariesContainer()->Add(std::move(typeRX), entry);
-
- return true;
- } else if (type == eNamedSummary) {
- // system named summaries do not exist (yet?)
- DataVisualization::NamedSummaryFormats::Add(type_name, entry);
- return true;
- } else {
- category->GetTypeSummariesContainer()->Add(std::move(type_name), entry);
- return true;
}
+ category->AddTypeSummary(type_name.GetStringRef(), match_type, entry);
+ return true;
}
// CommandObjectTypeSummaryDelete
}
}
+ FormatterMatchType match_type = eFormatterMatchExact;
if (type == eRegexSynth) {
+ match_type = eFormatterMatchRegex;
RegularExpression typeRX(type_name.GetStringRef());
if (!typeRX.IsValid()) {
if (error)
"regex format error (maybe this is not really a regex?)");
return false;
}
-
- category->GetRegexTypeSyntheticsContainer()->Delete(type_name);
- category->GetRegexTypeSyntheticsContainer()->Add(std::move(typeRX), entry);
-
- return true;
- } else {
- category->GetTypeSyntheticsContainer()->Add(std::move(type_name), entry);
- return true;
}
+
+ category->AddTypeSynthetic(type_name.GetStringRef(), match_type, entry);
+ return true;
}
#endif
}
}
+ FormatterMatchType match_type = eFormatterMatchExact;
if (type == eRegexFilter) {
+ match_type = eFormatterMatchRegex;
RegularExpression typeRX(type_name.GetStringRef());
if (!typeRX.IsValid()) {
if (error)
"regex format error (maybe this is not really a regex?)");
return false;
}
-
- category->GetRegexTypeFiltersContainer()->Delete(type_name);
- category->GetRegexTypeFiltersContainer()->Add(std::move(typeRX), entry);
-
- return true;
- } else {
- category->GetTypeFiltersContainer()->Add(std::move(type_name), entry);
- return true;
}
+ category->AddTypeFilter(type_name.GetStringRef(), match_type, entry);
+ return true;
}
public:
lldb::TypeSummaryImplSP string_array_format(
new StringSummaryFormat(string_array_flags, "${var%char[]}"));
- RegularExpression any_size_char_arr(R"(^((un)?signed )?char ?\[[0-9]+\]$)");
-
TypeCategoryImpl::SharedPointer sys_category_sp =
GetCategory(m_system_category_name);
- sys_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression(R"(^(unsigned )?char ?(\*|\[\])$)"), string_format);
+ sys_category_sp->AddTypeSummary(R"(^(unsigned )?char ?(\*|\[\])$)",
+ eFormatterMatchRegex, string_format);
- sys_category_sp->GetRegexTypeSummariesContainer()->Add(
- std::move(any_size_char_arr), string_array_format);
+ sys_category_sp->AddTypeSummary(R"(^((un)?signed )?char ?\[[0-9]+\]$)",
+ eFormatterMatchRegex, string_array_format);
lldb::TypeSummaryImplSP ostype_summary(
new StringSummaryFormat(TypeSummaryImpl::Flags()
.SetHideItemNames(false),
"${var%O}"));
- sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("OSType"),
- ostype_summary);
+ sys_category_sp->AddTypeSummary("OSType", eFormatterMatchExact,
+ ostype_summary);
TypeFormatImpl::Flags fourchar_flags;
fourchar_flags.SetCascades(true).SetSkipPointers(true).SetSkipReferences(
ConstString type_name, TypeFormatImpl::Flags flags, bool regex) {
lldb::TypeFormatImplSP format_sp(new TypeFormatImpl_Format(format, flags));
- if (regex)
- category_sp->GetRegexTypeFormatsContainer()->Add(
- RegularExpression(type_name.GetStringRef()), format_sp);
- else
- category_sp->GetTypeFormatsContainer()->Add(std::move(type_name),
- format_sp);
+ FormatterMatchType match_type =
+ regex ? eFormatterMatchRegex : eFormatterMatchExact;
+ category_sp->AddTypeFormat(type_name.GetStringRef(), match_type, format_sp);
}
void lldb_private::formatters::AddSummary(
TypeCategoryImpl::SharedPointer category_sp, TypeSummaryImplSP summary_sp,
ConstString type_name, bool regex) {
- if (regex)
- category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression(type_name.GetStringRef()), summary_sp);
- else
- category_sp->GetTypeSummariesContainer()->Add(std::move(type_name),
- summary_sp);
+ FormatterMatchType match_type =
+ regex ? eFormatterMatchRegex : eFormatterMatchExact;
+ category_sp->AddTypeSummary(type_name.GetStringRef(), match_type, summary_sp);
}
void lldb_private::formatters::AddStringSummary(
ConstString type_name, TypeSummaryImpl::Flags flags, bool regex) {
lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags, string));
- if (regex)
- category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression(type_name.GetStringRef()), summary_sp);
- else
- category_sp->GetTypeSummariesContainer()->Add(std::move(type_name),
- summary_sp);
+ FormatterMatchType match_type =
+ regex ? eFormatterMatchRegex : eFormatterMatchExact;
+ category_sp->AddTypeSummary(type_name.GetStringRef(), match_type, summary_sp);
}
void lldb_private::formatters::AddOneLineSummary(
flags.SetShowMembersOneLiner(true);
lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags, ""));
- if (regex)
- category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression(type_name.GetStringRef()), summary_sp);
- else
- category_sp->GetTypeSummariesContainer()->Add(std::move(type_name),
- summary_sp);
+ FormatterMatchType match_type =
+ regex ? eFormatterMatchRegex : eFormatterMatchExact;
+ category_sp->AddTypeSummary(type_name.GetStringRef(), match_type, summary_sp);
}
void lldb_private::formatters::AddCXXSummary(
ConstString type_name, TypeSummaryImpl::Flags flags, bool regex) {
lldb::TypeSummaryImplSP summary_sp(
new CXXFunctionSummaryFormat(flags, funct, description));
- if (regex)
- category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression(type_name.GetStringRef()), summary_sp);
- else
- category_sp->GetTypeSummariesContainer()->Add(std::move(type_name),
- summary_sp);
+
+ FormatterMatchType match_type =
+ regex ? eFormatterMatchRegex : eFormatterMatchExact;
+ category_sp->AddTypeSummary(type_name.GetStringRef(), match_type, summary_sp);
}
void lldb_private::formatters::AddCXXSynthetic(
ScriptedSyntheticChildren::Flags flags, bool regex) {
lldb::SyntheticChildrenSP synth_sp(
new CXXSyntheticChildren(flags, description, generator));
- if (regex)
- category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpression(type_name.GetStringRef()), synth_sp);
- else
- category_sp->GetTypeSyntheticsContainer()->Add(std::move(type_name),
- synth_sp);
+ FormatterMatchType match_type =
+ regex ? eFormatterMatchRegex : eFormatterMatchExact;
+ category_sp->AddTypeSynthetic(type_name.GetStringRef(), match_type, synth_sp);
}
void lldb_private::formatters::AddFilter(
TypeFilterImplSP filter_sp(new TypeFilterImpl(flags));
for (auto child : children)
filter_sp->AddExpressionPath(child);
- if (regex)
- category_sp->GetRegexTypeFiltersContainer()->Add(
- RegularExpression(type_name.GetStringRef()), filter_sp);
- else
- category_sp->GetTypeFiltersContainer()->Add(std::move(type_name),
- filter_sp);
+ FormatterMatchType match_type =
+ regex ? eFormatterMatchRegex : eFormatterMatchExact;
+ category_sp->AddTypeFilter(type_name.GetStringRef(), match_type, filter_sp);
}
size_t lldb_private::formatters::ExtractIndexFromString(const char *item_name) {
}
void TypeCategoryImpl::Clear(FormatCategoryItems items) {
- if (items & eFormatCategoryItemFormat) {
- GetTypeFormatsContainer()->Clear();
- GetRegexTypeFormatsContainer()->Clear();
- }
+ if (items & eFormatCategoryItemFormat)
+ m_format_cont.Clear();
- if (items & eFormatCategoryItemSummary) {
- GetTypeSummariesContainer()->Clear();
- GetRegexTypeSummariesContainer()->Clear();
- }
+ if (items & eFormatCategoryItemSummary)
+ m_summary_cont.Clear();
- if (items & eFormatCategoryItemFilter) {
- GetTypeFiltersContainer()->Clear();
- GetRegexTypeFiltersContainer()->Clear();
- }
+ if (items & eFormatCategoryItemFilter)
+ m_filter_cont.Clear();
- if (items & eFormatCategoryItemSynth) {
- GetTypeSyntheticsContainer()->Clear();
- GetRegexTypeSyntheticsContainer()->Clear();
- }
+ if (items & eFormatCategoryItemSynth)
+ m_synth_cont.Clear();
}
bool TypeCategoryImpl::Delete(ConstString name, FormatCategoryItems items) {
bool success = false;
- if (items & eFormatCategoryItemFormat) {
- success = GetTypeFormatsContainer()->Delete(name) || success;
- success = GetRegexTypeFormatsContainer()->Delete(name) || success;
- }
+ if (items & eFormatCategoryItemFormat)
+ success = m_format_cont.Delete(name) || success;
- if (items & eFormatCategoryItemSummary) {
- success = GetTypeSummariesContainer()->Delete(name) || success;
- success = GetRegexTypeSummariesContainer()->Delete(name) || success;
- }
+ if (items & eFormatCategoryItemSummary)
+ success = m_summary_cont.Delete(name) || success;
- if (items & eFormatCategoryItemFilter) {
- success = GetTypeFiltersContainer()->Delete(name) || success;
- success = GetRegexTypeFiltersContainer()->Delete(name) || success;
- }
+ if (items & eFormatCategoryItemFilter)
+ success = m_filter_cont.Delete(name) || success;
- if (items & eFormatCategoryItemSynth) {
- success = GetTypeSyntheticsContainer()->Delete(name) || success;
- success = GetRegexTypeSyntheticsContainer()->Delete(name) || success;
- }
+ if (items & eFormatCategoryItemSynth)
+ success = m_synth_cont.Delete(name) || success;
return success;
}
uint32_t TypeCategoryImpl::GetCount(FormatCategoryItems items) {
uint32_t count = 0;
- if (items & eFormatCategoryItemFormat) {
- count += GetTypeFormatsContainer()->GetCount();
- count += GetRegexTypeFormatsContainer()->GetCount();
- }
+ if (items & eFormatCategoryItemFormat)
+ count += m_format_cont.GetCount();
- if (items & eFormatCategoryItemSummary) {
- count += GetTypeSummariesContainer()->GetCount();
- count += GetRegexTypeSummariesContainer()->GetCount();
- }
+ if (items & eFormatCategoryItemSummary)
+ count += m_summary_cont.GetCount();
- if (items & eFormatCategoryItemFilter) {
- count += GetTypeFiltersContainer()->GetCount();
- count += GetRegexTypeFiltersContainer()->GetCount();
- }
+ if (items & eFormatCategoryItemFilter)
+ count += m_filter_cont.GetCount();
- if (items & eFormatCategoryItemSynth) {
- count += GetTypeSyntheticsContainer()->GetCount();
- count += GetRegexTypeSyntheticsContainer()->GetCount();
- }
+ if (items & eFormatCategoryItemSynth)
+ count += m_synth_cont.GetCount();
return count;
}
ScriptedSyntheticChildren::SharedPointer synth_sp;
if (items & eFormatCategoryItemFormat) {
- if (GetTypeFormatsContainer()->Get(type_name, format_sp) ||
- GetRegexTypeFormatsContainer()->Get(type_name, format_sp)) {
+ if (m_format_cont.AnyMatches(type_name)) {
if (matching_category)
*matching_category = m_name.GetCString();
if (matching_type)
}
if (items & eFormatCategoryItemSummary) {
- if (GetTypeSummariesContainer()->Get(type_name, summary_sp) ||
- GetRegexTypeSummariesContainer()->Get(type_name, summary_sp)) {
+ if (m_summary_cont.AnyMatches(type_name)) {
if (matching_category)
*matching_category = m_name.GetCString();
if (matching_type)
}
if (items & eFormatCategoryItemFilter) {
- if (GetTypeFiltersContainer()->Get(type_name, filter_sp) ||
- GetRegexTypeFiltersContainer()->Get(type_name, filter_sp)) {
+ if (m_filter_cont.AnyMatches(type_name)) {
if (matching_category)
*matching_category = m_name.GetCString();
if (matching_type)
}
if (items & eFormatCategoryItemSynth) {
- if (GetTypeSyntheticsContainer()->Get(type_name, synth_sp) ||
- GetRegexTypeSyntheticsContainer()->Get(type_name, synth_sp)) {
+ if (m_synth_cont.AnyMatches(type_name)) {
if (matching_category)
*matching_category = m_name.GetCString();
if (matching_type)
return false;
}
+void TypeCategoryImpl::AutoComplete(CompletionRequest &request,
+ FormatCategoryItems items) {
+ if (items & eFormatCategoryItemFormat)
+ m_format_cont.AutoComplete(request);
+ if (items & eFormatCategoryItemSummary)
+ m_summary_cont.AutoComplete(request);
+ if (items & eFormatCategoryItemFilter)
+ m_filter_cont.AutoComplete(request);
+ if (items & eFormatCategoryItemSynth)
+ m_synth_cont.AutoComplete(request);
+}
+
TypeCategoryImpl::FormatContainer::MapValueType
TypeCategoryImpl::GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp) {
return m_format_cont.GetForTypeNameSpecifier(type_sp);
ConstString("^std::__[[:alnum:]]+::span<.+>(( )?&)?$"), stl_deref_flags,
true);
- cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpression("^(std::__[[:alnum:]]+::)deque<.+>(( )?&)?$"),
+ cpp_category_sp->AddTypeSynthetic(
+ "^(std::__[[:alnum:]]+::)deque<.+>(( )?&)?$", eFormatterMatchRegex,
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_synth_flags,
"lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
stl_summary_flags, LibStdcppWStringSummaryProvider,
"libstdc++ c++11 std::wstring summary provider"));
- cpp_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::string"),
- std_string_summary_sp);
- cpp_category_sp->GetTypeSummariesContainer()->Add(
- ConstString("std::basic_string<char>"), std_string_summary_sp);
- cpp_category_sp->GetTypeSummariesContainer()->Add(
- ConstString("std::basic_string<char,std::char_traits<char>,std::"
- "allocator<char> >"),
- std_string_summary_sp);
- cpp_category_sp->GetTypeSummariesContainer()->Add(
- ConstString("std::basic_string<char, std::char_traits<char>, "
- "std::allocator<char> >"),
- std_string_summary_sp);
-
- cpp_category_sp->GetTypeSummariesContainer()->Add(
- ConstString("std::__cxx11::string"), cxx11_string_summary_sp);
- cpp_category_sp->GetTypeSummariesContainer()->Add(
- ConstString("std::__cxx11::basic_string<char, std::char_traits<char>, "
- "std::allocator<char> >"),
- cxx11_string_summary_sp);
- cpp_category_sp->GetTypeSummariesContainer()->Add(
- ConstString("std::__cxx11::basic_string<unsigned char, "
- "std::char_traits<unsigned char>, "
- "std::allocator<unsigned char> >"),
- cxx11_string_summary_sp);
+ cpp_category_sp->AddTypeSummary("std::string", eFormatterMatchExact,
+ std_string_summary_sp);
+ cpp_category_sp->AddTypeSummary("std::basic_string<char>",
+ eFormatterMatchRegex, std_string_summary_sp);
+ cpp_category_sp->AddTypeSummary(
+ "std::basic_string<char,std::char_traits<char>,std::allocator<char> >",
+ eFormatterMatchExact, std_string_summary_sp);
+ cpp_category_sp->AddTypeSummary(
+ "std::basic_string<char, std::char_traits<char>, std::allocator<char> >",
+ eFormatterMatchExact, std_string_summary_sp);
+
+ cpp_category_sp->AddTypeSummary("std::__cxx11::string", eFormatterMatchExact,
+ cxx11_string_summary_sp);
+ cpp_category_sp->AddTypeSummary(
+ "std::__cxx11::basic_string<char, std::char_traits<char>, "
+ "std::allocator<char> >",
+ eFormatterMatchExact, cxx11_string_summary_sp);
+ cpp_category_sp->AddTypeSummary("std::__cxx11::basic_string<unsigned char, "
+ "std::char_traits<unsigned char>, "
+ "std::allocator<unsigned char> >",
+ eFormatterMatchExact,
+ cxx11_string_summary_sp);
// making sure we force-pick the summary for printing wstring (_M_p is a
// wchar_t*)
lldb::TypeSummaryImplSP std_wstring_summary_sp(
new StringSummaryFormat(stl_summary_flags, "${var._M_dataplus._M_p%S}"));
- cpp_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::wstring"),
- std_wstring_summary_sp);
- cpp_category_sp->GetTypeSummariesContainer()->Add(
- ConstString("std::basic_string<wchar_t>"), std_wstring_summary_sp);
- cpp_category_sp->GetTypeSummariesContainer()->Add(
- ConstString("std::basic_string<wchar_t,std::char_traits<wchar_t>,std::"
- "allocator<wchar_t> >"),
- std_wstring_summary_sp);
- cpp_category_sp->GetTypeSummariesContainer()->Add(
- ConstString("std::basic_string<wchar_t, std::char_traits<wchar_t>, "
- "std::allocator<wchar_t> >"),
- std_wstring_summary_sp);
-
- cpp_category_sp->GetTypeSummariesContainer()->Add(
- ConstString("std::__cxx11::wstring"), cxx11_wstring_summary_sp);
- cpp_category_sp->GetTypeSummariesContainer()->Add(
- ConstString("std::__cxx11::basic_string<wchar_t, "
- "std::char_traits<wchar_t>, std::allocator<wchar_t> >"),
- cxx11_wstring_summary_sp);
+ cpp_category_sp->AddTypeSummary("std::wstring", eFormatterMatchExact,
+ std_wstring_summary_sp);
+ cpp_category_sp->AddTypeSummary("std::basic_string<wchar_t>",
+ eFormatterMatchExact, std_wstring_summary_sp);
+ cpp_category_sp->AddTypeSummary("std::basic_string<wchar_t,std::char_traits<"
+ "wchar_t>,std::allocator<wchar_t> >",
+ eFormatterMatchExact, std_wstring_summary_sp);
+ cpp_category_sp->AddTypeSummary(
+ "std::basic_string<wchar_t, std::char_traits<wchar_t>, "
+ "std::allocator<wchar_t> >",
+ eFormatterMatchExact, std_wstring_summary_sp);
+
+ cpp_category_sp->AddTypeSummary("std::__cxx11::wstring", eFormatterMatchExact,
+ cxx11_wstring_summary_sp);
+ cpp_category_sp->AddTypeSummary(
+ "std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, "
+ "std::allocator<wchar_t> >",
+ eFormatterMatchExact, cxx11_wstring_summary_sp);
SyntheticChildren::Flags stl_synth_flags;
stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(
SyntheticChildren::Flags stl_deref_flags = stl_synth_flags;
stl_deref_flags.SetFrontEndWantsDereference();
- cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpression("^std::vector<.+>(( )?&)?$"),
+ cpp_category_sp->AddTypeSynthetic(
+ "^std::vector<.+>(( )?&)?$", eFormatterMatchRegex,
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
- cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpression("^std::map<.+> >(( )?&)?$"),
+ cpp_category_sp->AddTypeSynthetic(
+ "^std::map<.+> >(( )?&)?$", eFormatterMatchRegex,
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
- cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpression("^std::deque<.+>(( )?&)?$"),
+ cpp_category_sp->AddTypeSynthetic(
+ "^std::deque<.+>(( )?&)?$", eFormatterMatchRegex,
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_deref_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdDequeSynthProvider")));
- cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpression("^std::set<.+> >(( )?&)?$"),
+ cpp_category_sp->AddTypeSynthetic(
+ "^std::set<.+> >(( )?&)?$", eFormatterMatchRegex,
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_deref_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
- cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpression("^std::multimap<.+> >(( )?&)?$"),
+ cpp_category_sp->AddTypeSynthetic(
+ "^std::multimap<.+> >(( )?&)?$", eFormatterMatchRegex,
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_deref_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
- cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpression("^std::multiset<.+> >(( )?&)?$"),
+ cpp_category_sp->AddTypeSynthetic(
+ "^std::multiset<.+> >(( )?&)?$", eFormatterMatchRegex,
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_deref_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider")));
- cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpression("^std::unordered_(multi)?(map|set)<.+> >$"),
+ cpp_category_sp->AddTypeSynthetic(
+ "^std::unordered_(multi)?(map|set)<.+> >$", eFormatterMatchRegex,
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_deref_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider")));
- cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpression("^std::(__cxx11::)?list<.+>(( )?&)?$"),
+ cpp_category_sp->AddTypeSynthetic(
+ "^std::(__cxx11::)?list<.+>(( )?&)?$", eFormatterMatchRegex,
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_deref_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
- cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpression("^std::(__cxx11::)?forward_list<.+>(( )?&)?$"),
+ cpp_category_sp->AddTypeSynthetic(
+ "^std::(__cxx11::)?forward_list<.+>(( )?&)?$", eFormatterMatchRegex,
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdForwardListSynthProvider")));
stl_summary_flags.SetDontShowChildren(false);
stl_summary_flags.SetSkipPointers(false);
- cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression("^std::bitset<.+>(( )?&)?$"),
- TypeSummaryImplSP(
- new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
- cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression("^std::vector<.+>(( )?&)?$"),
- TypeSummaryImplSP(
- new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
- cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression("^std::map<.+> >(( )?&)?$"),
- TypeSummaryImplSP(
- new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
- cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression("^std::set<.+> >(( )?&)?$"),
- TypeSummaryImplSP(
- new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
- cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression("^std::deque<.+>(( )?&)?$"),
- TypeSummaryImplSP(
- new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
- cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression("^std::multimap<.+> >(( )?&)?$"),
- TypeSummaryImplSP(
- new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
- cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression("^std::multiset<.+> >(( )?&)?$"),
- TypeSummaryImplSP(
- new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
- cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression("^std::unordered_(multi)?(map|set)<.+> >$"),
- TypeSummaryImplSP(
- new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
- cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression("^std::(__cxx11::)?list<.+>(( )?&)?$"),
- TypeSummaryImplSP(
- new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
- cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpression("^std::(__cxx11::)?forward_list<.+>(( )?&)?$"),
- TypeSummaryImplSP(
- new ScriptSummaryFormat(stl_summary_flags, "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider")));
+ cpp_category_sp->AddTypeSummary("^std::bitset<.+>(( )?&)?$",
+ eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ stl_summary_flags, "size=${svar%#}")));
+ cpp_category_sp->AddTypeSummary("^std::vector<.+>(( )?&)?$",
+ eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ stl_summary_flags, "size=${svar%#}")));
+ cpp_category_sp->AddTypeSummary("^std::map<.+> >(( )?&)?$",
+ eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ stl_summary_flags, "size=${svar%#}")));
+ cpp_category_sp->AddTypeSummary("^std::set<.+> >(( )?&)?$",
+ eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ stl_summary_flags, "size=${svar%#}")));
+ cpp_category_sp->AddTypeSummary("^std::deque<.+>(( )?&)?$",
+ eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ stl_summary_flags, "size=${svar%#}")));
+ cpp_category_sp->AddTypeSummary("^std::multimap<.+> >(( )?&)?$",
+ eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ stl_summary_flags, "size=${svar%#}")));
+ cpp_category_sp->AddTypeSummary("^std::multiset<.+> >(( )?&)?$",
+ eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ stl_summary_flags, "size=${svar%#}")));
+ cpp_category_sp->AddTypeSummary("^std::unordered_(multi)?(map|set)<.+> >$",
+ eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ stl_summary_flags, "size=${svar%#}")));
+ cpp_category_sp->AddTypeSummary("^std::(__cxx11::)?list<.+>(( )?&)?$",
+ eFormatterMatchRegex,
+ TypeSummaryImplSP(new StringSummaryFormat(
+ stl_summary_flags, "size=${svar%#}")));
+ cpp_category_sp->AddTypeSummary(
+ "^std::(__cxx11::)?forward_list<.+>(( )?&)?$", eFormatterMatchRegex,
+ TypeSummaryImplSP(new ScriptSummaryFormat(
+ stl_summary_flags,
+ "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider")));
AddCXXSynthetic(
cpp_category_sp,
lldb::TypeSummaryImplSP ObjC_BOOL_summary(new CXXFunctionSummaryFormat(
objc_flags, lldb_private::formatters::ObjCBOOLSummaryProvider, ""));
- objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL"),
- ObjC_BOOL_summary);
- objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL &"),
- ObjC_BOOL_summary);
- objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL *"),
- ObjC_BOOL_summary);
+ objc_category_sp->AddTypeSummary("BOOL", eFormatterMatchExact,
+ ObjC_BOOL_summary);
+ objc_category_sp->AddTypeSummary("BOOL &", eFormatterMatchExact,
+ ObjC_BOOL_summary);
+ objc_category_sp->AddTypeSummary("BOOL *", eFormatterMatchExact,
+ ObjC_BOOL_summary);
// we need to skip pointers here since we are special casing a SEL* when
// retrieving its value