[Lldb-commits] [lldb] f387b99 - [DataFormatters] Change the Get() method to take a LanguageType.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 10 15:21:32 PST 2019


Author: Davide Italiano
Date: 2019-12-10T15:21:24-08:00
New Revision: f387b99745101d5843d397a2a65dc4102c6f8e14

URL: https://github.com/llvm/llvm-project/commit/f387b99745101d5843d397a2a65dc4102c6f8e14
DIFF: https://github.com/llvm/llvm-project/commit/f387b99745101d5843d397a2a65dc4102c6f8e14.diff

LOG: [DataFormatters] Change the Get() method to take a LanguageType.

Suggested by Adrian.

Added: 
    

Modified: 
    lldb/include/lldb/DataFormatters/TypeCategory.h
    lldb/source/DataFormatters/LanguageCategory.cpp
    lldb/source/DataFormatters/TypeCategory.cpp
    lldb/source/DataFormatters/TypeCategoryMap.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/DataFormatters/TypeCategory.h b/lldb/include/lldb/DataFormatters/TypeCategory.h
index f37c661d56d0..513e859815f5 100644
--- a/lldb/include/lldb/DataFormatters/TypeCategory.h
+++ b/lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -332,16 +332,16 @@ class TypeCategoryImpl {
       return m_enabled_position;
   }
 
-  bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+  bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
            lldb::TypeFormatImplSP &entry, uint32_t *reason = nullptr);
 
-  bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+  bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
            lldb::TypeSummaryImplSP &entry, uint32_t *reason = nullptr);
 
-  bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+  bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
            lldb::SyntheticChildrenSP &entry, uint32_t *reason = nullptr);
 
-  bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+  bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
            lldb::TypeValidatorImplSP &entry, uint32_t *reason = nullptr);
 
   void Clear(FormatCategoryItems items = ALL_ITEM_TYPES);

diff  --git a/lldb/source/DataFormatters/LanguageCategory.cpp b/lldb/source/DataFormatters/LanguageCategory.cpp
index 64a891804c57..86de28060254 100644
--- a/lldb/source/DataFormatters/LanguageCategory.cpp
+++ b/lldb/source/DataFormatters/LanguageCategory.cpp
@@ -48,8 +48,8 @@ bool LanguageCategory::Get(FormattersMatchData &match_data,
   }
 
   ValueObject &valobj(match_data.GetValueObject());
-  bool result =
-      m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
+  bool result = m_category_sp->Get(valobj.GetObjectRuntimeLanguage(),
+                                   match_data.GetMatchesVector(), format_sp);
   if (match_data.GetTypeForCache() &&
       (!format_sp || !format_sp->NonCacheable())) {
     m_format_cache.Set(match_data.GetTypeForCache(), format_sp);
@@ -71,8 +71,8 @@ bool LanguageCategory::Get(FormattersMatchData &match_data,
   }
 
   ValueObject &valobj(match_data.GetValueObject());
-  bool result =
-      m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
+  bool result = m_category_sp->Get(valobj.GetObjectRuntimeLanguage(),
+                                   match_data.GetMatchesVector(), format_sp);
   if (match_data.GetTypeForCache() &&
       (!format_sp || !format_sp->NonCacheable())) {
     m_format_cache.Set(match_data.GetTypeForCache(), format_sp);
@@ -94,8 +94,8 @@ bool LanguageCategory::Get(FormattersMatchData &match_data,
   }
 
   ValueObject &valobj(match_data.GetValueObject());
-  bool result =
-      m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
+  bool result = m_category_sp->Get(valobj.GetObjectRuntimeLanguage(),
+                                   match_data.GetMatchesVector(), format_sp);
   if (match_data.GetTypeForCache() &&
       (!format_sp || !format_sp->NonCacheable())) {
     m_format_cache.Set(match_data.GetTypeForCache(), format_sp);
@@ -117,8 +117,8 @@ bool LanguageCategory::Get(FormattersMatchData &match_data,
   }
 
   ValueObject &valobj(match_data.GetValueObject());
-  bool result =
-      m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
+  bool result = m_category_sp->Get(valobj.GetObjectRuntimeLanguage(),
+                                   match_data.GetMatchesVector(), format_sp);
   if (match_data.GetTypeForCache() &&
       (!format_sp || !format_sp->NonCacheable())) {
     m_format_cache.Set(match_data.GetTypeForCache(), format_sp);

diff  --git a/lldb/source/DataFormatters/TypeCategory.cpp b/lldb/source/DataFormatters/TypeCategory.cpp
index 4f8ea5d43411..7a04b59b1c84 100644
--- a/lldb/source/DataFormatters/TypeCategory.cpp
+++ b/lldb/source/DataFormatters/TypeCategory.cpp
@@ -85,10 +85,10 @@ void TypeCategoryImpl::AddLanguage(lldb::LanguageType lang) {
   m_languages.push_back(lang);
 }
 
-bool TypeCategoryImpl::Get(ValueObject &valobj,
+bool TypeCategoryImpl::Get(lldb::LanguageType lang,
                            const FormattersMatchVector &candidates,
                            lldb::TypeFormatImplSP &entry, uint32_t *reason) {
-  if (!IsEnabled() || !IsApplicable(valobj.GetObjectRuntimeLanguage()))
+  if (!IsEnabled() || !IsApplicable(lang))
     return false;
   if (GetTypeFormatsContainer()->Get(candidates, entry, reason))
     return true;
@@ -98,10 +98,10 @@ bool TypeCategoryImpl::Get(ValueObject &valobj,
   return regex;
 }
 
-bool TypeCategoryImpl::Get(ValueObject &valobj,
+bool TypeCategoryImpl::Get(lldb::LanguageType lang,
                            const FormattersMatchVector &candidates,
                            lldb::TypeSummaryImplSP &entry, uint32_t *reason) {
-  if (!IsEnabled() || !IsApplicable(valobj.GetObjectRuntimeLanguage()))
+  if (!IsEnabled() || !IsApplicable(lang))
     return false;
   if (GetTypeSummariesContainer()->Get(candidates, entry, reason))
     return true;
@@ -111,10 +111,10 @@ bool TypeCategoryImpl::Get(ValueObject &valobj,
   return regex;
 }
 
-bool TypeCategoryImpl::Get(ValueObject &valobj,
+bool TypeCategoryImpl::Get(lldb::LanguageType lang,
                            const FormattersMatchVector &candidates,
                            lldb::SyntheticChildrenSP &entry, uint32_t *reason) {
-  if (!IsEnabled() || !IsApplicable(valobj.GetObjectRuntimeLanguage()))
+  if (!IsEnabled() || !IsApplicable(lang))
     return false;
   TypeFilterImpl::SharedPointer filter_sp;
   uint32_t reason_filter = 0;
@@ -158,7 +158,7 @@ bool TypeCategoryImpl::Get(ValueObject &valobj,
   return false;
 }
 
-bool TypeCategoryImpl::Get(ValueObject &valobj,
+bool TypeCategoryImpl::Get(lldb::LanguageType lang,
                            const FormattersMatchVector &candidates,
                            lldb::TypeValidatorImplSP &entry, uint32_t *reason) {
   if (!IsEnabled())

diff  --git a/lldb/source/DataFormatters/TypeCategoryMap.cpp b/lldb/source/DataFormatters/TypeCategoryMap.cpp
index 08f9bc3f1a4d..9bbecd9f420b 100644
--- a/lldb/source/DataFormatters/TypeCategoryMap.cpp
+++ b/lldb/source/DataFormatters/TypeCategoryMap.cpp
@@ -197,9 +197,9 @@ void TypeCategoryMap::Get(FormattersMatchData &match_data, ImplSP &retval) {
     ImplSP current_format;
     LLDB_LOGF(log, "[%s] Trying to use category %s", __FUNCTION__,
               category_sp->GetName());
-    if (!category_sp->Get(match_data.GetValueObject(),
-                          match_data.GetMatchesVector(), current_format,
-                          &reason_why))
+    if (!category_sp->Get(
+            match_data.GetValueObject().GetObjectRuntimeLanguage(),
+            match_data.GetMatchesVector(), current_format, &reason_why))
       continue;
 
     retval = std::move(current_format);


        


More information about the lldb-commits mailing list