[Lldb-commits] [lldb] [lldb][Formatters] Add --pointer-match-depth option to `type summary add` command. (PR #138209)
via lldb-commits
lldb-commits at lists.llvm.org
Thu May 1 15:33:19 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- lldb/test/API/functionalities/data-formatter/data-formatter-ptr-matching/main.cpp lldb/include/lldb/API/SBTypeSummary.h lldb/include/lldb/DataFormatters/FormatClasses.h lldb/include/lldb/DataFormatters/FormatManager.h lldb/include/lldb/DataFormatters/FormattersContainer.h lldb/include/lldb/DataFormatters/TypeFormat.h lldb/include/lldb/DataFormatters/TypeSummary.h lldb/include/lldb/DataFormatters/TypeSynthetic.h lldb/source/API/SBTypeSummary.cpp lldb/source/Commands/CommandObjectType.cpp lldb/source/DataFormatters/FormatManager.cpp lldb/source/DataFormatters/TypeCategoryMap.cpp lldb/source/DataFormatters/TypeSummary.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/source/API/SBTypeSummary.cpp b/lldb/source/API/SBTypeSummary.cpp
index d7acb0670..58ec068ab 100644
--- a/lldb/source/API/SBTypeSummary.cpp
+++ b/lldb/source/API/SBTypeSummary.cpp
@@ -232,7 +232,7 @@ const char *SBTypeSummary::GetData() {
uint32_t SBTypeSummary::GetPtrMatchDepth() {
LLDB_INSTRUMENT_VA(this);
-
+
if (!IsValid())
return 0;
return m_opaque_sp->GetPtrMatchDepth();
diff --git a/lldb/source/DataFormatters/TypeCategoryMap.cpp b/lldb/source/DataFormatters/TypeCategoryMap.cpp
index 8682e4b74..c318e1d2d 100644
--- a/lldb/source/DataFormatters/TypeCategoryMap.cpp
+++ b/lldb/source/DataFormatters/TypeCategoryMap.cpp
@@ -184,10 +184,8 @@ void TypeCategoryMap::Get(FormattersMatchData &match_data, ImplSP &retval) {
if (log) {
for (auto match : match_data.GetMatchesVector()) {
LLDB_LOGF(
- log,
- "[%s] candidate match = %s %s %s %s ptr-stripped-depth=%u",
- __FUNCTION__,
- match.GetTypeName().GetCString(),
+ log, "[%s] candidate match = %s %s %s %s ptr-stripped-depth=%u",
+ __FUNCTION__, match.GetTypeName().GetCString(),
match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
match.DidStripReference() ? "strip-reference" : "no-strip-reference",
match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-ptr-matching/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-ptr-matching/main.cpp
index 5fafae53d..2d8c7193b 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-ptr-matching/main.cpp
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-ptr-matching/main.cpp
@@ -2,31 +2,31 @@ struct Int {
int i;
};
typedef Int Foo;
-typedef Int* FooP;
+typedef Int *FooP;
typedef Foo Bar;
-typedef Foo* BarP;
+typedef Foo *BarP;
int main() {
Int i = {42};
- Int* i_p = &i;
- Int** i_pp = &i_p;
- Int*** i_ppp = &i_pp;
+ Int *i_p = &i;
+ Int **i_pp = &i_p;
+ Int ***i_ppp = &i_pp;
Foo f = i;
- Foo* f_p = &f;
- Foo** f_pp = &f_p;
- Foo*** f_ppp = &f_pp;
+ Foo *f_p = &f;
+ Foo **f_pp = &f_p;
+ Foo ***f_ppp = &f_pp;
FooP fp = f_p;
- FooP* fp_p = &fp;
- FooP** fp_pp = &fp_p;
+ FooP *fp_p = &fp;
+ FooP **fp_pp = &fp_p;
Bar b = i;
- Bar* b_p = &b;
- Bar** b_pp = &b_p;
+ Bar *b_p = &b;
+ Bar **b_pp = &b_p;
BarP bp = b_p;
- BarP* bp_p = &bp;
- BarP** bp_pp = &bp_p;
+ BarP *bp_p = &bp;
+ BarP **bp_pp = &bp_p;
return 0; // Set break point at this line.
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/138209
More information about the lldb-commits
mailing list