[Lldb-commits] [lldb] 7edfbf2 - [lldb][DataFormatter] Fix format specifiers in LibCxxSliceArray summary provider (#85763)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 19 04:26:46 PDT 2024
Author: Michael Buch
Date: 2024-03-19T11:26:43Z
New Revision: 7edfbf2af2253297f48ff8adaba99373f67e8dca
URL: https://github.com/llvm/llvm-project/commit/7edfbf2af2253297f48ff8adaba99373f67e8dca
DIFF: https://github.com/llvm/llvm-project/commit/7edfbf2af2253297f48ff8adaba99373f67e8dca.diff
LOG: [lldb][DataFormatter] Fix format specifiers in LibCxxSliceArray summary provider (#85763)
This caused following warnings in an LLDB build:
```
[237/1072] Building CXX object tools/l...lusLanguage.dir/LibCxxSliceArray.cpp.o
/Volumes/Data/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp:38:53: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
38 | stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size);
| ~~~~~~~~~ ^~~~~~
/Volumes/Data/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp:38:61: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
38 | stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size);
| ~~~~~~~~~ ^~~~
2 warnings generated.
```
This patch simply changes the format specifiers to use the `%zu` for
`size_t`s.
Added:
Modified:
lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp
index 323de11b1c97c9..32e67d2e38c5d3 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp
@@ -35,7 +35,7 @@ bool LibcxxStdSliceArraySummaryProvider(ValueObject &valobj, Stream &stream,
return false;
const size_t stride = ptr_sp->GetValueAsUnsigned(0);
- stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size);
+ stream.Printf("stride=%zu size=%zu", stride, size);
return true;
}
More information about the lldb-commits
mailing list