[compiler-rt] abe102b - [Sanitizer][NFC] Replaces a few `InternalScopedString::AppendF` with `InternalScopedString::Append` (#80574)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 5 17:18:10 PST 2024
Author: Enna1
Date: 2024-02-06T09:18:06+08:00
New Revision: abe102b87204a8b5bb637b675ed58ee6695016af
URL: https://github.com/llvm/llvm-project/commit/abe102b87204a8b5bb637b675ed58ee6695016af
DIFF: https://github.com/llvm/llvm-project/commit/abe102b87204a8b5bb637b675ed58ee6695016af.diff
LOG: [Sanitizer][NFC] Replaces a few `InternalScopedString::AppendF` with `InternalScopedString::Append` (#80574)
Added:
Modified:
compiler-rt/lib/asan/asan_descriptions.cpp
compiler-rt/lib/hwasan/hwasan_report.cpp
compiler-rt/lib/memprof/memprof_descriptions.cpp
compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp
compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_descriptions.cpp b/compiler-rt/lib/asan/asan_descriptions.cpp
index ef6f3e0a096f8..05a277cfa0a84 100644
--- a/compiler-rt/lib/asan/asan_descriptions.cpp
+++ b/compiler-rt/lib/asan/asan_descriptions.cpp
@@ -245,11 +245,11 @@ static void PrintAccessAndVarIntersection(const StackVarDescr &var, uptr addr,
InternalScopedString str;
str.AppendF(" [%zd, %zd)", var.beg, var_end);
// Render variable name.
- str.AppendF(" '");
+ str.Append(" '");
for (uptr i = 0; i < var.name_len; ++i) {
str.AppendF("%c", var.name_pos[i]);
}
- str.AppendF("'");
+ str.Append("'");
if (var.line > 0) {
str.AppendF(" (line %zd)", var.line);
}
@@ -260,7 +260,7 @@ static void PrintAccessAndVarIntersection(const StackVarDescr &var, uptr addr,
str.AppendF("%s <== Memory access at offset %zd %s this variable%s\n",
d.Location(), addr, pos_descr, d.Default());
} else {
- str.AppendF("\n");
+ str.Append("\n");
}
Printf("%s", str.data());
}
diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 12a4fa47f2151..c3d260d1a61fa 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -388,7 +388,7 @@ static void PrintTagInfoAroundAddr(uptr addr, uptr num_rows,
print_tag(s, row + i);
s.Append(row + i == addr ? "]" : " ");
}
- s.AppendF("\n");
+ s.Append("\n");
}
}
@@ -418,10 +418,10 @@ static void PrintTagsAroundAddr(uptr addr, GetTag get_tag,
tag_t short_tag = get_short_tag(tag_addr);
s.AppendF("%02x", short_tag);
} else {
- s.AppendF("..");
+ s.Append("..");
}
});
- s.AppendF(
+ s.Append(
"See "
"https://clang.llvm.org/docs/"
"HardwareAssistedAddressSanitizerDesign.html#short-granules for a "
@@ -947,16 +947,16 @@ TailOverwrittenReport::~TailOverwrittenReport() {
InternalScopedString s;
u8 *tail = tail_copy;
- s.AppendF("Tail contains: ");
- for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.AppendF(".. ");
+ s.Append("Tail contains: ");
+ for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.Append(".. ");
for (uptr i = 0; i < tail_size; i++) s.AppendF("%02x ", tail[i]);
- s.AppendF("\n");
- s.AppendF("Expected: ");
- for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.AppendF(".. ");
+ s.Append("\n");
+ s.Append("Expected: ");
+ for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.Append(".. ");
for (uptr i = 0; i < tail_size; i++) s.AppendF("%02x ", actual_expected[i]);
- s.AppendF("\n");
- s.AppendF(" ");
- for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.AppendF(" ");
+ s.Append("\n");
+ s.Append(" ");
+ for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.Append(" ");
for (uptr i = 0; i < tail_size; i++)
s.AppendF("%s ", actual_expected[i] != tail[i] ? "^^" : " ");
diff --git a/compiler-rt/lib/memprof/memprof_descriptions.cpp b/compiler-rt/lib/memprof/memprof_descriptions.cpp
index 48b74b6bc87fb..4fbe2943e6539 100644
--- a/compiler-rt/lib/memprof/memprof_descriptions.cpp
+++ b/compiler-rt/lib/memprof/memprof_descriptions.cpp
@@ -51,7 +51,7 @@ void DescribeThread(MemprofThreadContext *context) {
InternalScopedString str;
str.AppendF("Thread %s", MemprofThreadIdAndName(context).c_str());
if (context->parent_tid == kInvalidTid) {
- str.AppendF(" created by unknown thread\n");
+ str.Append(" created by unknown thread\n");
Printf("%s", str.data());
return;
}
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp
index 561eae9ab7806..1a0e00d5d5af2 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp
@@ -63,7 +63,7 @@ class StackTraceTextPrinter {
if (dedup_frames_-- > 0) {
if (dedup_token_->length())
- dedup_token_->AppendF("--");
+ dedup_token_->Append("--");
if (stack->info.function)
dedup_token_->Append(stack->info.function);
}
@@ -99,7 +99,7 @@ void StackTrace::PrintTo(InternalScopedString *output) const {
output, &dedup_token);
if (trace == nullptr || size == 0) {
- output->AppendF(" <empty stack>\n\n");
+ output->Append(" <empty stack>\n\n");
return;
}
@@ -111,7 +111,7 @@ void StackTrace::PrintTo(InternalScopedString *output) const {
}
// Always add a trailing empty line after stack trace.
- output->AppendF("\n");
+ output->Append("\n");
// Append deduplication token, if non-empty.
if (dedup_token.length())
@@ -198,7 +198,7 @@ void __sanitizer_symbolize_pc(uptr pc, const char *fmt, char *out_buf,
StackTraceTextPrinter printer(fmt, '\0', &output, nullptr);
if (!printer.ProcessAddressFrames(pc)) {
output.clear();
- output.AppendF("<can't symbolize>");
+ output.Append("<can't symbolize>");
}
CopyStringToBuffer(output, out_buf, out_buf_size);
}
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
index 748d832ccc211..b23796fccf6e3 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
@@ -152,12 +152,12 @@ static void MaybeBuildIdToBuffer(const AddressInfo &info, bool PrefixSpace,
InternalScopedString *buffer) {
if (info.uuid_size) {
if (PrefixSpace)
- buffer->AppendF(" ");
- buffer->AppendF("(BuildId: ");
+ buffer->Append(" ");
+ buffer->Append("(BuildId: ");
for (uptr i = 0; i < info.uuid_size; ++i) {
buffer->AppendF("%02x", info.uuid[i]);
}
- buffer->AppendF(")");
+ buffer->Append(")");
}
}
@@ -249,7 +249,7 @@ void FormattedStackTracePrinter::RenderFrame(InternalScopedString *buffer,
MaybeBuildIdToBuffer(*info, /*PrefixSpace=*/true, buffer);
#endif
} else {
- buffer->AppendF("(<unknown module>)");
+ buffer->Append("(<unknown module>)");
}
break;
case 'M':
@@ -339,7 +339,7 @@ void StackTracePrinter::RenderSourceLocation(InternalScopedString *buffer,
buffer->AppendF("%s(%d", StripPathPrefix(file, strip_path_prefix), line);
if (column > 0)
buffer->AppendF(",%d", column);
- buffer->AppendF(")");
+ buffer->Append(")");
return;
}
More information about the llvm-commits
mailing list