Skip to content

Commit abe102b

Browse files
authored
[Sanitizer][NFC] Replaces a few InternalScopedString::AppendF with InternalScopedString::Append (#80574)
1 parent 06a728f commit abe102b

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

compiler-rt/lib/asan/asan_descriptions.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@ static void PrintAccessAndVarIntersection(const StackVarDescr &var, uptr addr,
245245
InternalScopedString str;
246246
str.AppendF(" [%zd, %zd)", var.beg, var_end);
247247
// Render variable name.
248-
str.AppendF(" '");
248+
str.Append(" '");
249249
for (uptr i = 0; i < var.name_len; ++i) {
250250
str.AppendF("%c", var.name_pos[i]);
251251
}
252-
str.AppendF("'");
252+
str.Append("'");
253253
if (var.line > 0) {
254254
str.AppendF(" (line %zd)", var.line);
255255
}
@@ -260,7 +260,7 @@ static void PrintAccessAndVarIntersection(const StackVarDescr &var, uptr addr,
260260
str.AppendF("%s <== Memory access at offset %zd %s this variable%s\n",
261261
d.Location(), addr, pos_descr, d.Default());
262262
} else {
263-
str.AppendF("\n");
263+
str.Append("\n");
264264
}
265265
Printf("%s", str.data());
266266
}

compiler-rt/lib/hwasan/hwasan_report.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static void PrintTagInfoAroundAddr(uptr addr, uptr num_rows,
388388
print_tag(s, row + i);
389389
s.Append(row + i == addr ? "]" : " ");
390390
}
391-
s.AppendF("\n");
391+
s.Append("\n");
392392
}
393393
}
394394

@@ -418,10 +418,10 @@ static void PrintTagsAroundAddr(uptr addr, GetTag get_tag,
418418
tag_t short_tag = get_short_tag(tag_addr);
419419
s.AppendF("%02x", short_tag);
420420
} else {
421-
s.AppendF("..");
421+
s.Append("..");
422422
}
423423
});
424-
s.AppendF(
424+
s.Append(
425425
"See "
426426
"https://clang.llvm.org/docs/"
427427
"HardwareAssistedAddressSanitizerDesign.html#short-granules for a "
@@ -947,16 +947,16 @@ TailOverwrittenReport::~TailOverwrittenReport() {
947947

948948
InternalScopedString s;
949949
u8 *tail = tail_copy;
950-
s.AppendF("Tail contains: ");
951-
for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.AppendF(".. ");
950+
s.Append("Tail contains: ");
951+
for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.Append(".. ");
952952
for (uptr i = 0; i < tail_size; i++) s.AppendF("%02x ", tail[i]);
953-
s.AppendF("\n");
954-
s.AppendF("Expected: ");
955-
for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.AppendF(".. ");
953+
s.Append("\n");
954+
s.Append("Expected: ");
955+
for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.Append(".. ");
956956
for (uptr i = 0; i < tail_size; i++) s.AppendF("%02x ", actual_expected[i]);
957-
s.AppendF("\n");
958-
s.AppendF(" ");
959-
for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.AppendF(" ");
957+
s.Append("\n");
958+
s.Append(" ");
959+
for (uptr i = 0; i < kShadowAlignment - tail_size; i++) s.Append(" ");
960960
for (uptr i = 0; i < tail_size; i++)
961961
s.AppendF("%s ", actual_expected[i] != tail[i] ? "^^" : " ");
962962

compiler-rt/lib/memprof/memprof_descriptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void DescribeThread(MemprofThreadContext *context) {
5151
InternalScopedString str;
5252
str.AppendF("Thread %s", MemprofThreadIdAndName(context).c_str());
5353
if (context->parent_tid == kInvalidTid) {
54-
str.AppendF(" created by unknown thread\n");
54+
str.Append(" created by unknown thread\n");
5555
Printf("%s", str.data());
5656
return;
5757
}

compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class StackTraceTextPrinter {
6363

6464
if (dedup_frames_-- > 0) {
6565
if (dedup_token_->length())
66-
dedup_token_->AppendF("--");
66+
dedup_token_->Append("--");
6767
if (stack->info.function)
6868
dedup_token_->Append(stack->info.function);
6969
}
@@ -99,7 +99,7 @@ void StackTrace::PrintTo(InternalScopedString *output) const {
9999
output, &dedup_token);
100100

101101
if (trace == nullptr || size == 0) {
102-
output->AppendF(" <empty stack>\n\n");
102+
output->Append(" <empty stack>\n\n");
103103
return;
104104
}
105105

@@ -111,7 +111,7 @@ void StackTrace::PrintTo(InternalScopedString *output) const {
111111
}
112112

113113
// Always add a trailing empty line after stack trace.
114-
output->AppendF("\n");
114+
output->Append("\n");
115115

116116
// Append deduplication token, if non-empty.
117117
if (dedup_token.length())
@@ -198,7 +198,7 @@ void __sanitizer_symbolize_pc(uptr pc, const char *fmt, char *out_buf,
198198
StackTraceTextPrinter printer(fmt, '\0', &output, nullptr);
199199
if (!printer.ProcessAddressFrames(pc)) {
200200
output.clear();
201-
output.AppendF("<can't symbolize>");
201+
output.Append("<can't symbolize>");
202202
}
203203
CopyStringToBuffer(output, out_buf, out_buf_size);
204204
}

compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ static void MaybeBuildIdToBuffer(const AddressInfo &info, bool PrefixSpace,
152152
InternalScopedString *buffer) {
153153
if (info.uuid_size) {
154154
if (PrefixSpace)
155-
buffer->AppendF(" ");
156-
buffer->AppendF("(BuildId: ");
155+
buffer->Append(" ");
156+
buffer->Append("(BuildId: ");
157157
for (uptr i = 0; i < info.uuid_size; ++i) {
158158
buffer->AppendF("%02x", info.uuid[i]);
159159
}
160-
buffer->AppendF(")");
160+
buffer->Append(")");
161161
}
162162
}
163163

@@ -249,7 +249,7 @@ void FormattedStackTracePrinter::RenderFrame(InternalScopedString *buffer,
249249
MaybeBuildIdToBuffer(*info, /*PrefixSpace=*/true, buffer);
250250
#endif
251251
} else {
252-
buffer->AppendF("(<unknown module>)");
252+
buffer->Append("(<unknown module>)");
253253
}
254254
break;
255255
case 'M':
@@ -339,7 +339,7 @@ void StackTracePrinter::RenderSourceLocation(InternalScopedString *buffer,
339339
buffer->AppendF("%s(%d", StripPathPrefix(file, strip_path_prefix), line);
340340
if (column > 0)
341341
buffer->AppendF(",%d", column);
342-
buffer->AppendF(")");
342+
buffer->Append(")");
343343
return;
344344
}
345345

0 commit comments

Comments
 (0)