jgorbe created this revision.
jgorbe added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
jgorbe requested review of this revision.

TypeCategoryImpl has its own implementation of these, so it makes no
sense to have the same logic inlined in SBTypeCategory.

There are other methods in SBTypeCategory that are directly implemented
there, instead of delegating to TypeCategoryImpl (which IMO kinda
defeats the point of having an "opaque" member pointer in the SB type),
but they don't have equivalent implementations in TypeCategoryImpl, so
this patch only picks the low-hanging fruit for now.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133230

Files:
  lldb/source/API/SBTypeCategory.cpp


Index: lldb/source/API/SBTypeCategory.cpp
===================================================================
--- lldb/source/API/SBTypeCategory.cpp
+++ lldb/source/API/SBTypeCategory.cpp
@@ -185,14 +185,8 @@
   if (!spec.IsValid())
     return SBTypeFilter();
 
-  lldb::TypeFilterImplSP children_sp;
-
-  if (spec.IsRegex())
-    m_opaque_sp->GetRegexTypeFiltersContainer()->GetExact(
-        ConstString(spec.GetName()), children_sp);
-  else
-    m_opaque_sp->GetTypeFiltersContainer()->GetExact(
-        ConstString(spec.GetName()), children_sp);
+  lldb::TypeFilterImplSP children_sp =
+      m_opaque_sp->GetFilterForType(spec.GetSP());
 
   if (!children_sp)
     return lldb::SBTypeFilter();
@@ -211,14 +205,8 @@
   if (!spec.IsValid())
     return SBTypeFormat();
 
-  lldb::TypeFormatImplSP format_sp;
-
-  if (spec.IsRegex())
-    m_opaque_sp->GetRegexTypeFormatsContainer()->GetExact(
-        ConstString(spec.GetName()), format_sp);
-  else
-    m_opaque_sp->GetTypeFormatsContainer()->GetExact(
-        ConstString(spec.GetName()), format_sp);
+  lldb::TypeFormatImplSP format_sp =
+      m_opaque_sp->GetFormatForType(spec.GetSP());
 
   if (!format_sp)
     return lldb::SBTypeFormat();
@@ -235,14 +223,8 @@
   if (!spec.IsValid())
     return SBTypeSummary();
 
-  lldb::TypeSummaryImplSP summary_sp;
-
-  if (spec.IsRegex())
-    m_opaque_sp->GetRegexTypeSummariesContainer()->GetExact(
-        ConstString(spec.GetName()), summary_sp);
-  else
-    m_opaque_sp->GetTypeSummariesContainer()->GetExact(
-        ConstString(spec.GetName()), summary_sp);
+  lldb::TypeSummaryImplSP summary_sp =
+      m_opaque_sp->GetSummaryForType(spec.GetSP());
 
   if (!summary_sp)
     return lldb::SBTypeSummary();
@@ -259,14 +241,8 @@
   if (!spec.IsValid())
     return SBTypeSynthetic();
 
-  lldb::SyntheticChildrenSP children_sp;
-
-  if (spec.IsRegex())
-    m_opaque_sp->GetRegexTypeSyntheticsContainer()->GetExact(
-        ConstString(spec.GetName()), children_sp);
-  else
-    m_opaque_sp->GetTypeSyntheticsContainer()->GetExact(
-        ConstString(spec.GetName()), children_sp);
+  lldb::SyntheticChildrenSP children_sp =
+      m_opaque_sp->GetSyntheticForType(spec.GetSP());
 
   if (!children_sp)
     return lldb::SBTypeSynthetic();


Index: lldb/source/API/SBTypeCategory.cpp
===================================================================
--- lldb/source/API/SBTypeCategory.cpp
+++ lldb/source/API/SBTypeCategory.cpp
@@ -185,14 +185,8 @@
   if (!spec.IsValid())
     return SBTypeFilter();
 
-  lldb::TypeFilterImplSP children_sp;
-
-  if (spec.IsRegex())
-    m_opaque_sp->GetRegexTypeFiltersContainer()->GetExact(
-        ConstString(spec.GetName()), children_sp);
-  else
-    m_opaque_sp->GetTypeFiltersContainer()->GetExact(
-        ConstString(spec.GetName()), children_sp);
+  lldb::TypeFilterImplSP children_sp =
+      m_opaque_sp->GetFilterForType(spec.GetSP());
 
   if (!children_sp)
     return lldb::SBTypeFilter();
@@ -211,14 +205,8 @@
   if (!spec.IsValid())
     return SBTypeFormat();
 
-  lldb::TypeFormatImplSP format_sp;
-
-  if (spec.IsRegex())
-    m_opaque_sp->GetRegexTypeFormatsContainer()->GetExact(
-        ConstString(spec.GetName()), format_sp);
-  else
-    m_opaque_sp->GetTypeFormatsContainer()->GetExact(
-        ConstString(spec.GetName()), format_sp);
+  lldb::TypeFormatImplSP format_sp =
+      m_opaque_sp->GetFormatForType(spec.GetSP());
 
   if (!format_sp)
     return lldb::SBTypeFormat();
@@ -235,14 +223,8 @@
   if (!spec.IsValid())
     return SBTypeSummary();
 
-  lldb::TypeSummaryImplSP summary_sp;
-
-  if (spec.IsRegex())
-    m_opaque_sp->GetRegexTypeSummariesContainer()->GetExact(
-        ConstString(spec.GetName()), summary_sp);
-  else
-    m_opaque_sp->GetTypeSummariesContainer()->GetExact(
-        ConstString(spec.GetName()), summary_sp);
+  lldb::TypeSummaryImplSP summary_sp =
+      m_opaque_sp->GetSummaryForType(spec.GetSP());
 
   if (!summary_sp)
     return lldb::SBTypeSummary();
@@ -259,14 +241,8 @@
   if (!spec.IsValid())
     return SBTypeSynthetic();
 
-  lldb::SyntheticChildrenSP children_sp;
-
-  if (spec.IsRegex())
-    m_opaque_sp->GetRegexTypeSyntheticsContainer()->GetExact(
-        ConstString(spec.GetName()), children_sp);
-  else
-    m_opaque_sp->GetTypeSyntheticsContainer()->GetExact(
-        ConstString(spec.GetName()), children_sp);
+  lldb::SyntheticChildrenSP children_sp =
+      m_opaque_sp->GetSyntheticForType(spec.GetSP());
 
   if (!children_sp)
     return lldb::SBTypeSynthetic();
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to