Fix a bug where language categories would hold on to their caches even after changes

llvm-svn: 255603
This commit is contained in:
Enrico Granata
2015-12-15 02:20:48 +00:00
parent dcba338188
commit bd5eab8287
4 changed files with 32 additions and 15 deletions

View File

@@ -123,6 +123,19 @@ GetFormatFromFormatName (const char *format_name, bool partial_match_ok, Format
return false;
}
void
FormatManager::Changed ()
{
++m_last_revision;
m_format_cache.Clear ();
Mutex::Locker lang_locker(m_language_categories_mutex);
for (auto& iter : m_language_categories_map)
{
if (iter.second)
iter.second->GetFormatCache().Clear();
}
}
bool
FormatManager::GetFormatFromCString (const char *format_cstr,
bool partial_match_ok,
@@ -1043,12 +1056,12 @@ FormatManager::GetHardcodedValidator (FormattersMatchData& match_data)
}
FormatManager::FormatManager() :
m_format_cache(),
m_named_summaries_map(this),
m_last_revision(0),
m_categories_map(this),
m_language_categories_map(),
m_format_cache(),
m_language_categories_mutex(Mutex::eMutexTypeRecursive),
m_language_categories_map(),
m_named_summaries_map(this),
m_categories_map(this),
m_default_category_name(ConstString("default")),
m_system_category_name(ConstString("system")),
m_vectortypes_category_name(ConstString("VectorTypes"))
@@ -1063,7 +1076,6 @@ FormatManager::FormatManager() :
void
FormatManager::LoadSystemFormatters()
{
TypeSummaryImpl::Flags string_flags;
string_flags.SetCascades(true)
.SetSkipPointers(true)

View File

@@ -242,6 +242,12 @@ LanguageCategory::GetCategory () const
return m_category_sp;
}
FormatCache&
LanguageCategory::GetFormatCache ()
{
return m_format_cache;
}
void
LanguageCategory::Enable ()
{