mirror of
https://github.com/intel/llvm.git
synced 2026-02-07 07:39:11 +08:00
[FormatManager] Move Language lookup into the obviously non-cached part (NFC)
This refactoring makes the lookup caching easier to reason about. This has no observable effect although it does slightly change what is being cached. - Before this patch a negative lookup in the LanguageCategory would be cached, but a positive wouldn't. - After this patch LanguageCategory lookups aren't cached by FormatManager, period. (LanguageCategory has its own FormatCache for this!) Differential Revision: https://reviews.llvm.org/D71289
This commit is contained in:
@@ -630,7 +630,22 @@ ImplSP FormatManager::Get(ValueObject &valobj,
|
||||
return retval_sp;
|
||||
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
|
||||
LLDB_LOGF(log, "[%s] Search failed. Giving hardcoded a chance.", __FUNCTION__);
|
||||
|
||||
LLDB_LOGF(log, "[%s] Search failed. Giving language a chance.", __FUNCTION__);
|
||||
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
||||
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
||||
ImplSP retval_sp;
|
||||
if (lang_category->Get(match_data, retval_sp))
|
||||
if (retval_sp) {
|
||||
LLDB_LOGF(log, "[%s] Language search success. Returning.",
|
||||
__FUNCTION__);
|
||||
return retval_sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLDB_LOGF(log, "[%s] Search failed. Giving hardcoded a chance.",
|
||||
__FUNCTION__);
|
||||
return GetHardcoded<ImplSP>(match_data);
|
||||
}
|
||||
|
||||
@@ -655,21 +670,6 @@ ImplSP FormatManager::GetCached(FormattersMatchData &match_data) {
|
||||
}
|
||||
|
||||
m_categories_map.Get(match_data, retval_sp);
|
||||
if (!retval_sp) {
|
||||
LLDB_LOGF(log, "[%s] Search failed. Giving language a chance.",
|
||||
__FUNCTION__);
|
||||
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
||||
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
||||
if (lang_category->Get(match_data, retval_sp))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (retval_sp) {
|
||||
LLDB_LOGF(log, "[%s] Language search success. Returning.", __FUNCTION__);
|
||||
return retval_sp;
|
||||
}
|
||||
}
|
||||
|
||||
if (match_data.GetTypeForCache() && (!retval_sp || !retval_sp->NonCacheable())) {
|
||||
LLDB_LOGF(log, "[%s] Caching %p for type %s", __FUNCTION__,
|
||||
static_cast<void *>(retval_sp.get()),
|
||||
|
||||
Reference in New Issue
Block a user