class FormattersMatchCandidate {
public:
- FormattersMatchCandidate(ConstString name, uint32_t reason, bool strip_ptr,
+ FormattersMatchCandidate(ConstString name, bool strip_ptr,
bool strip_ref, bool strip_tydef)
- : m_type_name(name), m_reason(reason), m_stripped_pointer(strip_ptr),
+ : m_type_name(name), m_stripped_pointer(strip_ptr),
m_stripped_reference(strip_ref), m_stripped_typedef(strip_tydef) {}
~FormattersMatchCandidate() = default;
ConstString GetTypeName() const { return m_type_name; }
- uint32_t GetReason() const { return m_reason; }
-
bool DidStripPointer() const { return m_stripped_pointer; }
bool DidStripReference() const { return m_stripped_reference; }
private:
ConstString m_type_name;
- uint32_t m_reason;
bool m_stripped_pointer;
bool m_stripped_reference;
bool m_stripped_typedef;
GetPossibleMatches(ValueObject &valobj, lldb::DynamicValueType use_dynamic) {
FormattersMatchVector matches;
GetPossibleMatches(valobj, valobj.GetCompilerType(),
- lldb_private::eFormatterChoiceCriterionDirectChoice,
use_dynamic, matches, false, false, false, true);
return matches;
}
private:
static void GetPossibleMatches(ValueObject &valobj,
- CompilerType compiler_type, uint32_t reason,
+ CompilerType compiler_type,
lldb::DynamicValueType use_dynamic,
FormattersMatchVector &entries,
bool did_strip_ptr, bool did_strip_ref,
}
bool Get(ValueObject &valobj, MapValueType &entry,
- lldb::DynamicValueType use_dynamic, uint32_t *why = nullptr) {
- uint32_t value = lldb_private::eFormatterChoiceCriterionDirectChoice;
+ lldb::DynamicValueType use_dynamic) {
CompilerType ast_type(valobj.GetCompilerType());
- bool ret = Get(valobj, ast_type, entry, use_dynamic, value);
+ bool ret = Get(valobj, ast_type, entry, use_dynamic);
if (ret)
entry = MapValueType(entry);
else
entry = MapValueType();
- if (why)
- *why = value;
return ret;
}
return false;
}
- bool Get(const FormattersMatchVector &candidates, MapValueType &entry,
- uint32_t *reason) {
+ bool Get(const FormattersMatchVector &candidates, MapValueType &entry) {
for (const FormattersMatchCandidate &candidate : candidates) {
if (Get(candidate.GetTypeName(), entry)) {
if (candidate.IsMatch(entry) == false) {
entry.reset();
continue;
} else {
- if (reason)
- *reason = candidate.GetReason();
return true;
}
}
}
bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
- lldb::TypeFormatImplSP &entry, uint32_t *reason = nullptr);
+ lldb::TypeFormatImplSP &entry);
bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
- lldb::TypeSummaryImplSP &entry, uint32_t *reason = nullptr);
+ lldb::TypeSummaryImplSP &entry);
bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
- lldb::SyntheticChildrenSP &entry, uint32_t *reason = nullptr);
+ lldb::SyntheticChildrenSP &entry);
void Clear(FormatCategoryItems items = ALL_ITEM_TYPES);
eExecutionPolicyTopLevel // used for top-level code
};
-// Ways that the FormatManager picks a particular format for a type
-enum FormatterChoiceCriterion {
- eFormatterChoiceCriterionDirectChoice = 0x00000000,
- eFormatterChoiceCriterionStrippedPointerReference = 0x00000001,
- eFormatterChoiceCriterionNavigatedTypedefs = 0x00000002,
- eFormatterChoiceCriterionRegularExpressionSummary = 0x00000004,
- eFormatterChoiceCriterionRegularExpressionFilter = 0x00000004,
- eFormatterChoiceCriterionLanguagePlugin = 0x00000008,
- eFormatterChoiceCriterionStrippedBitField = 0x00000010,
- eFormatterChoiceCriterionWentToStaticValue = 0x00000020
-};
-
// Synchronicity behavior of scripted commands
enum ScriptedCommandSynchronicity {
eScriptedCommandSynchronicitySynchronous,
}
void FormatManager::GetPossibleMatches(
- ValueObject &valobj, CompilerType compiler_type, uint32_t reason,
+ ValueObject &valobj, CompilerType compiler_type,
lldb::DynamicValueType use_dynamic, FormattersMatchVector &entries,
bool did_strip_ptr, bool did_strip_ref, bool did_strip_typedef,
bool root_level) {
sstring.Printf("%s:%d", type_name.AsCString(), valobj.GetBitfieldBitSize());
ConstString bitfieldname(sstring.GetString());
entries.push_back(
- {bitfieldname, 0, did_strip_ptr, did_strip_ref, did_strip_typedef});
- reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField;
+ {bitfieldname, did_strip_ptr, did_strip_ref, did_strip_typedef});
}
if (!compiler_type.IsMeaninglessWithoutDynamicResolution()) {
entries.push_back(
- {type_name, reason, did_strip_ptr, did_strip_ref, did_strip_typedef});
+ {type_name, did_strip_ptr, did_strip_ref, did_strip_typedef});
ConstString display_type_name(compiler_type.GetTypeName());
if (display_type_name != type_name)
- entries.push_back({display_type_name, reason, did_strip_ptr,
+ entries.push_back({display_type_name, did_strip_ptr,
did_strip_ref, did_strip_typedef});
}
CompilerType non_ref_type = compiler_type.GetNonReferenceType();
GetPossibleMatches(
valobj, non_ref_type,
- reason |
- lldb_private::eFormatterChoiceCriterionStrippedPointerReference,
use_dynamic, entries, did_strip_ptr, true, did_strip_typedef);
if (non_ref_type.IsTypedefType()) {
CompilerType deffed_referenced_type = non_ref_type.GetTypedefedType();
: deffed_referenced_type.GetLValueReferenceType();
GetPossibleMatches(
valobj, deffed_referenced_type,
- reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
use_dynamic, entries, did_strip_ptr, did_strip_ref,
true); // this is not exactly the usual meaning of stripping typedefs
}
CompilerType non_ptr_type = compiler_type.GetPointeeType();
GetPossibleMatches(
valobj, non_ptr_type,
- reason |
- lldb_private::eFormatterChoiceCriterionStrippedPointerReference,
use_dynamic, entries, true, did_strip_ref, did_strip_typedef);
if (non_ptr_type.IsTypedefType()) {
CompilerType deffed_pointed_type =
const bool stripped_typedef = true;
GetPossibleMatches(
valobj, deffed_pointed_type,
- reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
use_dynamic, entries, did_strip_ptr, did_strip_ref,
stripped_typedef); // this is not exactly the usual meaning of
// stripping typedefs
const bool stripped_typedef = true;
GetPossibleMatches(
valobj, deffed_array_type,
- reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
use_dynamic, entries, did_strip_ptr, did_strip_ref,
stripped_typedef); // this is not exactly the usual meaning of
// stripping typedefs
language->GetPossibleFormattersMatches(valobj, use_dynamic)) {
entries.push_back(
{candidate,
- reason | lldb_private::eFormatterChoiceCriterionLanguagePlugin,
did_strip_ptr, did_strip_ref, did_strip_typedef});
}
}
CompilerType deffed_type = compiler_type.GetTypedefedType();
GetPossibleMatches(
valobj, deffed_type,
- reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
use_dynamic, entries, did_strip_ptr, did_strip_ref, true);
}
break;
if (unqual_compiler_ast_type.GetOpaqueQualType() !=
compiler_type.GetOpaqueQualType())
- GetPossibleMatches(valobj, unqual_compiler_ast_type, reason,
+ GetPossibleMatches(valobj, unqual_compiler_ast_type,
use_dynamic, entries, did_strip_ptr, did_strip_ref,
did_strip_typedef);
} while (false);
if (static_value_sp)
GetPossibleMatches(
*static_value_sp.get(), static_value_sp->GetCompilerType(),
- reason | lldb_private::eFormatterChoiceCriterionWentToStaticValue,
use_dynamic, entries, did_strip_ptr, did_strip_ref,
did_strip_typedef, true);
}
bool TypeCategoryImpl::Get(lldb::LanguageType lang,
const FormattersMatchVector &candidates,
- lldb::TypeFormatImplSP &entry, uint32_t *reason) {
+ lldb::TypeFormatImplSP &entry) {
if (!IsEnabled() || !IsApplicable(lang))
return false;
- if (GetTypeFormatsContainer()->Get(candidates, entry, reason))
+ if (GetTypeFormatsContainer()->Get(candidates, entry))
return true;
- bool regex = GetRegexTypeFormatsContainer()->Get(candidates, entry, reason);
- if (regex && reason)
- *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
+ bool regex = GetRegexTypeFormatsContainer()->Get(candidates, entry);
return regex;
}
bool TypeCategoryImpl::Get(lldb::LanguageType lang,
const FormattersMatchVector &candidates,
- lldb::TypeSummaryImplSP &entry, uint32_t *reason) {
+ lldb::TypeSummaryImplSP &entry) {
if (!IsEnabled() || !IsApplicable(lang))
return false;
- if (GetTypeSummariesContainer()->Get(candidates, entry, reason))
+ if (GetTypeSummariesContainer()->Get(candidates, entry))
return true;
- bool regex = GetRegexTypeSummariesContainer()->Get(candidates, entry, reason);
- if (regex && reason)
- *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
+ bool regex = GetRegexTypeSummariesContainer()->Get(candidates, entry);
return regex;
}
bool TypeCategoryImpl::Get(lldb::LanguageType lang,
const FormattersMatchVector &candidates,
- lldb::SyntheticChildrenSP &entry, uint32_t *reason) {
+ lldb::SyntheticChildrenSP &entry) {
if (!IsEnabled() || !IsApplicable(lang))
return false;
TypeFilterImpl::SharedPointer filter_sp;
- uint32_t reason_filter = 0;
bool regex_filter = false;
// first find both Filter and Synth, and then check which is most recent
- if (!GetTypeFiltersContainer()->Get(candidates, filter_sp, &reason_filter))
- regex_filter = GetRegexTypeFiltersContainer()->Get(candidates, filter_sp,
- &reason_filter);
+ if (!GetTypeFiltersContainer()->Get(candidates, filter_sp))
+ regex_filter = GetRegexTypeFiltersContainer()->Get(candidates, filter_sp);
bool regex_synth = false;
- uint32_t reason_synth = 0;
bool pick_synth = false;
ScriptedSyntheticChildren::SharedPointer synth;
- if (!GetTypeSyntheticsContainer()->Get(candidates, synth, &reason_synth))
- regex_synth = GetRegexTypeSyntheticsContainer()->Get(candidates, synth,
- &reason_synth);
+ if (!GetTypeSyntheticsContainer()->Get(candidates, synth))
+ regex_synth = GetRegexTypeSyntheticsContainer()->Get(candidates, synth);
if (!filter_sp.get() && !synth.get())
return false;
else if (!filter_sp.get() && synth.get())
pick_synth = filter_sp->GetRevision() <= synth->GetRevision();
}
if (pick_synth) {
- if (regex_synth && reason)
- *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
entry = synth;
return true;
} else {
- if (regex_filter && reason)
- *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
entry = filter_sp;
return true;
}
void TypeCategoryMap::Get(FormattersMatchData &match_data, ImplSP &retval) {
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
- uint32_t reason_why;
ActiveCategoriesIterator begin, end = m_active_categories.end();
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
for (auto match : match_data.GetMatchesVector()) {
LLDB_LOGF(
log,
- "[%s] candidate match = %s %s %s %s reason = %" PRIu32,
+ "[%s] candidate match = %s %s %s %s",
__FUNCTION__,
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());
+ match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef");
}
}
category_sp->GetName());
if (!category_sp->Get(
match_data.GetValueObject().GetObjectRuntimeLanguage(),
- match_data.GetMatchesVector(), current_format, &reason_why))
+ match_data.GetMatchesVector(), current_format))
continue;
retval = std::move(current_format);