[Lldb-commits] [PATCH] D133230: [NFCI] Remove duplicate code in SBTypeCategory
Jorge Gorbe Moya via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Sep 2 13:21:15 PDT 2022
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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133230.457686.patch
Type: text/x-patch
Size: 2263 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220902/5771b8c2/attachment.bin>
More information about the lldb-commits
mailing list