[compiler-rt] 693aa68 - [NFC][sanitizer] Remove InternalScopedString::Append nullptr workaround
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 15 23:09:37 PDT 2023
Author: Vitaly Buka
Date: 2023-09-15T23:08:13-07:00
New Revision: 693aa68b65f5b95e0935afda44a993787bca2ea8
URL: https://github.com/llvm/llvm-project/commit/693aa68b65f5b95e0935afda44a993787bca2ea8
DIFF: https://github.com/llvm/llvm-project/commit/693aa68b65f5b95e0935afda44a993787bca2ea8.diff
LOG: [NFC][sanitizer] Remove InternalScopedString::Append nullptr workaround
AppendF actually appends "<null>" which is not needed here.
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp
compiler-rt/lib/sanitizer_common/tests/sanitizer_common_test.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp
index 3d9d66c3f976139..62c1cf4abe4256b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp
@@ -338,8 +338,6 @@ int internal_snprintf(char *buffer, uptr length, const char *format, ...) {
}
void InternalScopedString::Append(const char *str) {
- if (!str) // For consistency with AppendF("%s", str) which accepts nullptr.
- return;
uptr prev_len = length();
uptr str_len = internal_strlen(str);
buffer_.resize(prev_len + str_len + 1);
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_common_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_common_test.cpp
index fc12c07bb914702..918d824f8bc76b0 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_common_test.cpp
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_common_test.cpp
@@ -381,10 +381,6 @@ TEST(SanitizerCommon, InternalScopedStringAppend) {
EXPECT_EQ(0U, str.length());
EXPECT_STREQ("", str.data());
- str.Append(nullptr);
- EXPECT_EQ(0U, str.length());
- EXPECT_STREQ("", str.data());
-
str.Append("");
EXPECT_EQ(0U, str.length());
EXPECT_STREQ("", str.data());
More information about the llvm-commits
mailing list