Author: Alex Langford
Date: 2026-07-09T14:50:30-07:00
New Revision: aa6db49c751b53c27529d1e2830ef06f8d48329e

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

LOG: [lldb] Tighten interface for TypeCategoryImpl::AnyMatches (#208321)

The last 2 parameters are never actually used by any caller so they can
be removed. `only_enabled` defaults to `true` but all callers explicitly
set this to false. I removed that and rewrote the body to assume it will
always be false.

Added: 
    

Modified: 
    lldb/include/lldb/DataFormatters/TypeCategory.h
    lldb/source/Commands/CommandObjectType.cpp
    lldb/source/DataFormatters/TypeCategory.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/DataFormatters/TypeCategory.h 
b/lldb/include/lldb/DataFormatters/TypeCategory.h
index 884a27d76e055..9011b43d44489 100644
--- a/lldb/include/lldb/DataFormatters/TypeCategory.h
+++ b/lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -347,10 +347,7 @@ class TypeCategoryImpl {
   std::string GetDescription();
 
   bool AnyMatches(const FormattersMatchCandidate &candidate_type,
-                  FormatCategoryItems items = ALL_ITEM_TYPES,
-                  bool only_enabled = true,
-                  const char **matching_category = nullptr,
-                  FormatCategoryItems *matching_type = nullptr);
+                  FormatCategoryItems items = ALL_ITEM_TYPES);
 
   void AutoComplete(CompletionRequest &request, FormatCategoryItems items);
 

diff  --git a/lldb/source/Commands/CommandObjectType.cpp 
b/lldb/source/Commands/CommandObjectType.cpp
index d86aca0e71854..c1dc949a7b815 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -2259,8 +2259,7 @@ bool CommandObjectTypeSynthAdd::AddSynth(ConstString 
type_name,
     // name-based lookup here to try to prevent conflicts.
     FormattersMatchCandidate candidate_type(type_name, nullptr, TypeImpl(),
                                             FormattersMatchCandidate::Flags());
-    if (category->AnyMatches(candidate_type, eFormatCategoryItemFilter,
-                             false)) {
+    if (category->AnyMatches(candidate_type, eFormatCategoryItemFilter)) {
       if (error)
         *error = Status::FromErrorStringWithFormatv(
             "cannot add synthetic for type {0} when "
@@ -2401,8 +2400,7 @@ class CommandObjectTypeFilterAdd : public 
CommandObjectParsed {
       FormattersMatchCandidate candidate_type(
           type_name, nullptr, TypeImpl(), FormattersMatchCandidate::Flags());
       lldb::SyntheticChildrenSP entry;
-      if (category->AnyMatches(candidate_type, eFormatCategoryItemSynth,
-                               false)) {
+      if (category->AnyMatches(candidate_type, eFormatCategoryItemSynth)) {
         if (error)
           *error = Status::FromErrorStringWithFormatv(
               "cannot add filter for type {0} when "

diff  --git a/lldb/source/DataFormatters/TypeCategory.cpp 
b/lldb/source/DataFormatters/TypeCategory.cpp
index 4d8663ea9c03e..b1cc0d61b4833 100644
--- a/lldb/source/DataFormatters/TypeCategory.cpp
+++ b/lldb/source/DataFormatters/TypeCategory.cpp
@@ -185,48 +185,27 @@ uint32_t TypeCategoryImpl::GetCount(FormatCategoryItems 
items) {
 }
 
 bool TypeCategoryImpl::AnyMatches(
-    const FormattersMatchCandidate &candidate_type, FormatCategoryItems items,
-    bool only_enabled, const char **matching_category,
-    FormatCategoryItems *matching_type) {
-  if (!IsEnabled() && only_enabled)
-    return false;
-
+    const FormattersMatchCandidate &candidate_type, FormatCategoryItems items) 
{
   if (items & eFormatCategoryItemFormat) {
     if (m_format_cont.AnyMatches(candidate_type)) {
-      if (matching_category)
-        *matching_category = m_name.GetCString();
-      if (matching_type)
-        *matching_type = eFormatCategoryItemFormat;
       return true;
     }
   }
 
   if (items & eFormatCategoryItemSummary) {
     if (m_summary_cont.AnyMatches(candidate_type)) {
-      if (matching_category)
-        *matching_category = m_name.GetCString();
-      if (matching_type)
-        *matching_type = eFormatCategoryItemSummary;
       return true;
     }
   }
 
   if (items & eFormatCategoryItemFilter) {
     if (m_filter_cont.AnyMatches(candidate_type)) {
-      if (matching_category)
-        *matching_category = m_name.GetCString();
-      if (matching_type)
-        *matching_type = eFormatCategoryItemFilter;
       return true;
     }
   }
 
   if (items & eFormatCategoryItemSynth) {
     if (m_synth_cont.AnyMatches(candidate_type)) {
-      if (matching_category)
-        *matching_category = m_name.GetCString();
-      if (matching_type)
-        *matching_type = eFormatCategoryItemSynth;
       return true;
     }
   }


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to