[Lldb-commits] [PATCH] D71305: [TypeCategory] IsApplicable gets a LanguageType, not a ValueObject.

Davide Italiano via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 10 14:46:47 PST 2019


davide created this revision.
davide added reviewers: aprantl, teemperor.
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71305

Files:
  lldb/include/lldb/DataFormatters/TypeCategory.h
  lldb/source/DataFormatters/TypeCategory.cpp


Index: lldb/source/DataFormatters/TypeCategory.cpp
===================================================================
--- lldb/source/DataFormatters/TypeCategory.cpp
+++ lldb/source/DataFormatters/TypeCategory.cpp
@@ -60,11 +60,10 @@
   }
 }
 
-bool TypeCategoryImpl::IsApplicable(ValueObject &valobj) {
-  lldb::LanguageType valobj_lang = valobj.GetObjectRuntimeLanguage();
+bool TypeCategoryImpl::IsApplicable(lldb::LanguageType lang) {
   for (size_t idx = 0; idx < GetNumLanguages(); idx++) {
     const lldb::LanguageType category_lang = GetLanguageAtIndex(idx);
-    if (::IsApplicable(category_lang, valobj_lang))
+    if (::IsApplicable(category_lang, lang))
       return true;
   }
   return false;
@@ -89,7 +88,7 @@
 bool TypeCategoryImpl::Get(ValueObject &valobj,
                            const FormattersMatchVector &candidates,
                            lldb::TypeFormatImplSP &entry, uint32_t *reason) {
-  if (!IsEnabled() || !IsApplicable(valobj))
+  if (!IsEnabled() || !IsApplicable(valobj.GetObjectRuntimeLanguage()))
     return false;
   if (GetTypeFormatsContainer()->Get(candidates, entry, reason))
     return true;
@@ -102,7 +101,7 @@
 bool TypeCategoryImpl::Get(ValueObject &valobj,
                            const FormattersMatchVector &candidates,
                            lldb::TypeSummaryImplSP &entry, uint32_t *reason) {
-  if (!IsEnabled() || !IsApplicable(valobj))
+  if (!IsEnabled() || !IsApplicable(valobj.GetObjectRuntimeLanguage()))
     return false;
   if (GetTypeSummariesContainer()->Get(candidates, entry, reason))
     return true;
@@ -115,7 +114,7 @@
 bool TypeCategoryImpl::Get(ValueObject &valobj,
                            const FormattersMatchVector &candidates,
                            lldb::SyntheticChildrenSP &entry, uint32_t *reason) {
-  if (!IsEnabled() || !IsApplicable(valobj))
+  if (!IsEnabled() || !IsApplicable(valobj.GetObjectRuntimeLanguage()))
     return false;
   TypeFilterImpl::SharedPointer filter_sp;
   uint32_t reason_filter = 0;
Index: lldb/include/lldb/DataFormatters/TypeCategory.h
===================================================================
--- lldb/include/lldb/DataFormatters/TypeCategory.h
+++ lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -391,7 +391,7 @@
 
   void Disable() { Enable(false, UINT32_MAX); }
 
-  bool IsApplicable(ValueObject &valobj);
+  bool IsApplicable(lldb::LanguageType lang);
 
   uint32_t GetLastEnabledPosition() { return m_enabled_position; }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71305.233196.patch
Type: text/x-patch
Size: 2484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191210/dcd7c753/attachment-0001.bin>


More information about the lldb-commits mailing list