[llvm] [Support] Trim trailing null character in PrettyStackTraceFormat. (PR #77351)
Jon Ross-Perkins via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 24 14:47:20 PST 2024
https://github.com/jonmeow updated https://github.com/llvm/llvm-project/pull/77351
>From 0c71d1fe9167a89af1603d6d30fc05078d2cc7bc Mon Sep 17 00:00:00 2001
From: jonmeow <jperkins at google.com>
Date: Mon, 8 Jan 2024 10:26:09 -0800
Subject: [PATCH] [Support] Trim trailing null character in
PrettyStackTraceFormat.
---
llvm/lib/Support/PrettyStackTrace.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/lib/Support/PrettyStackTrace.cpp b/llvm/lib/Support/PrettyStackTrace.cpp
index f9f1b8a419b8208..fc3e08e3662217b 100644
--- a/llvm/lib/Support/PrettyStackTrace.cpp
+++ b/llvm/lib/Support/PrettyStackTrace.cpp
@@ -249,6 +249,8 @@ PrettyStackTraceFormat::PrettyStackTraceFormat(const char *Format, ...) {
va_start(AP, Format);
vsnprintf(Str.data(), Size, Format, AP);
va_end(AP);
+ // Remove the '\0' for printing.
+ Str.pop_back();
}
void PrettyStackTraceFormat::print(raw_ostream &OS) const { OS << Str << "\n"; }
More information about the llvm-commits
mailing list