16 TypeCategoryImpl::TypeCategoryImpl(
18 std::initializer_list<lldb::LanguageType> langs)
19 : m_format_cont(
"format",
"regex-format", clist),
20 m_summary_cont(
"summary",
"regex-summary", clist),
21 m_filter_cont(
"filter",
"regex-filter", clist),
22 m_synth_cont(
"synth",
"regex-synth", clist),
23 m_validator_cont(
"validator",
"regex-validator", clist), m_enabled(false),
24 m_change_listener(clist), m_mutex(), m_name(name), m_languages() {
31 switch (category_lang) {
34 return category_lang == valobj_lang;
67 bool TypeCategoryImpl::IsApplicable(
ValueObject &valobj) {
71 if (::IsApplicable(category_lang, valobj_lang))
78 if (m_languages.empty())
80 return m_languages.size();
84 if (m_languages.empty())
86 return m_languages[idx];
90 m_languages.push_back(lang);
94 const auto iter = std::find(m_languages.begin(), m_languages.end(), lang),
95 end = m_languages.end();
101 lldb::TypeFormatImplSP &entry,
uint32_t *reason) {
102 if (!
IsEnabled() || !IsApplicable(valobj))
114 lldb::TypeSummaryImplSP &entry,
uint32_t *reason) {
115 if (!
IsEnabled() || !IsApplicable(valobj))
127 lldb::SyntheticChildrenSP &entry,
uint32_t *reason) {
128 if (!
IsEnabled() || !IsApplicable(valobj))
132 bool regex_filter =
false;
139 bool regex_synth =
false;
141 bool pick_synth =
false;
146 if (!filter_sp.get() && !synth.get())
148 else if (!filter_sp.get() && synth.get())
151 else if (filter_sp.get() && !synth.get())
156 pick_synth = filter_sp->GetRevision() <= synth->GetRevision();
159 if (regex_synth && reason)
164 if (regex_filter && reason)
174 lldb::TypeValidatorImplSP &entry,
uint32_t *reason) {
195 eFormatCategoryItemRegexSummary)
201 eFormatCategoryItemRegexFilter)
212 eFormatCategoryItemRegexValidator)
217 bool success =
false;
227 eFormatCategoryItemRegexSummary)
233 eFormatCategoryItemRegexFilter)
244 eFormatCategoryItemRegexValidator)
261 eFormatCategoryItemRegexSummary)
267 eFormatCategoryItemRegexFilter)
278 eFormatCategoryItemRegexValidator)
286 const char **matching_category,
291 lldb::TypeFormatImplSP format_sp;
292 lldb::TypeSummaryImplSP summary_sp;
299 if (matching_category)
307 eFormatCategoryItemRegexValue) {
309 if (matching_category)
319 if (matching_category)
327 eFormatCategoryItemRegexSummary) {
329 if (matching_category)
339 if (matching_category)
347 eFormatCategoryItemRegexFilter) {
349 if (matching_category)
359 if (matching_category)
367 eFormatCategoryItemRegexSynth) {
369 if (matching_category)
379 if (matching_category)
387 eFormatCategoryItemRegexValidator) {
389 if (matching_category)
405 if (type_sp->IsRegex())
421 if (type_sp->IsRegex())
437 if (type_sp->IsRegex())
453 if (type_sp->IsRegex())
469 if (type_sp->IsRegex())
480 lldb::TypeNameSpecifierImplSP
516 lldb::TypeNameSpecifierImplSP
525 lldb::TypeNameSpecifierImplSP
543 lldb::TypeNameSpecifierImplSP
561 lldb::TypeNameSpecifierImplSP
570 void TypeCategoryImpl::Enable(
bool value,
uint32_t position) {
571 std::lock_guard<std::recursive_mutex> guard(m_mutex);
572 if ((m_enabled = value))
573 m_enabled_position = position;
574 if (m_change_listener)
582 lang_stream.
Printf(
", applicable for language(s): ");
583 bool print_lang =
false;
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
FilterContainer::MapValueType GetFilterAtIndex(size_t index)
Enumerations for broadcasting.
SynthContainerSP GetTypeSyntheticsContainer()
virtual lldb::LanguageType GetObjectRuntimeLanguage()
FormatContainer::MapValueType GetFormatAtIndex(size_t index)
ValidatorContainer::MapValueType GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp)
SynthContainer::MapValueType GetSyntheticAtIndex(size_t index)
SummaryContainer::MapValueType GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp)
bool Get(ValueObject &valobj, const FormattersMatchVector &candidates, lldb::TypeFormatImplSP &entry, uint32_t *reason=nullptr)
void Clear(FormatCategoryItems items=ALL_ITEM_TYPES)
FormatContainerSP GetTypeFormatsContainer()
std::shared_ptr< TypeFilterImpl > SharedPointer
lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierForSummaryAtIndex(size_t index)
std::vector< FormattersMatchCandidate > FormattersMatchVector
ValidatorContainerSP GetTypeValidatorsContainer()
RegexValidatorContainerSP GetRegexTypeValidatorsContainer()
std::string GetDescription()
lldb::LanguageType GetLanguageAtIndex(size_t idx)
std::shared_ptr< SyntheticChildren > SharedPointer
RegexFilterContainerSP GetRegexTypeFiltersContainer()
FilterContainerSP GetTypeFiltersContainer()
LanguageType
Programming language type.
FilterContainer::MapValueType GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp)
SummaryContainerSP GetTypeSummariesContainer()
FormatContainer::MapValueType GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp)
llvm::StringRef GetString() const
bool HasLanguage(lldb::LanguageType lang)
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
uint32_t GetCount(FormatCategoryItems items=ALL_ITEM_TYPES)
lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierForFilterAtIndex(size_t index)
SynthContainer::MapValueType GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp)
void AddLanguage(lldb::LanguageType lang)
bool AnyMatches(ConstString type_name, FormatCategoryItems items=ALL_ITEM_TYPES, bool only_enabled=true, const char **matching_category=nullptr, FormatCategoryItems *matching_type=nullptr)
RegexFormatContainerSP GetRegexTypeFormatsContainer()
RegexSummaryContainerSP GetRegexTypeSummariesContainer()
lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierForSyntheticAtIndex(size_t index)
std::shared_ptr< TypeValidatorImpl > SharedPointer
lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierForValidatorAtIndex(size_t index)
ValidatorContainer::MapValueType GetValidatorAtIndex(size_t index)
A uniqued constant string class.
Unknown or invalid language value.
const char * GetCString() const
Get the string value as a C string.
Non-standardized C, such as K&R.
SummaryContainer::MapValueType GetSummaryAtIndex(size_t index)
static const char * GetNameForLanguageType(lldb::LanguageType language)
RegexSynthContainerSP GetRegexTypeSyntheticsContainer()
bool Delete(ConstString name, FormatCategoryItems items=ALL_ITEM_TYPES)
lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierForFormatAtIndex(size_t index)