[PATCH] D142464: [llvm] Do not zero out write_unsigned_impl internal buffer
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 25 22:59:50 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8f79b0fe0047: [llvm] Do not zero out write_unsigned_impl internal buffer (authored by serge-sans-paille).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142464/new/
https://reviews.llvm.org/D142464
Files:
llvm/lib/Support/NativeFormatting.cpp
llvm/unittests/Support/NativeFormatTests.cpp
Index: llvm/unittests/Support/NativeFormatTests.cpp
===================================================================
--- llvm/unittests/Support/NativeFormatTests.cpp
+++ llvm/unittests/Support/NativeFormatTests.cpp
@@ -48,6 +48,8 @@
TEST(NativeFormatTest, BasicIntegerTests) {
// Simple integers with no decimal.
EXPECT_EQ("0", format_number(0, IntegerStyle::Integer));
+ EXPECT_EQ("1", format_number(1, IntegerStyle::Integer));
+ EXPECT_EQ("-1", format_number(-1, IntegerStyle::Integer));
EXPECT_EQ("2425", format_number(2425, IntegerStyle::Integer));
EXPECT_EQ("-2425", format_number(-2425, IntegerStyle::Integer));
Index: llvm/lib/Support/NativeFormatting.cpp
===================================================================
--- llvm/lib/Support/NativeFormatting.cpp
+++ llvm/lib/Support/NativeFormatting.cpp
@@ -58,10 +58,7 @@
static_assert(std::is_unsigned_v<T>, "Value is not unsigned!");
char NumberBuffer[128];
- std::memset(NumberBuffer, '0', sizeof(NumberBuffer));
-
- size_t Len = 0;
- Len = format_to_buffer(N, NumberBuffer);
+ size_t Len = format_to_buffer(N, NumberBuffer);
if (IsNegative)
S << '-';
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142464.492340.patch
Type: text/x-patch
Size: 1159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230126/d186c9f2/attachment.bin>
More information about the llvm-commits
mailing list