[llvm-branch-commits] [llvm] [llvm-profdata] Remove exitWithError and LSan leak workaround (PR #228159)
Vitaly Buka via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Oct 1 16:56:58 PDT 2026
https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/228159
>From 75fa2bdf129aa9a865de33b852a15e213f2ec894 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Thu, 1 Oct 2026 09:55:12 -0700
Subject: [PATCH] [llvm-profdata] Remove exitWithError and LSan leak workaround
With all subcommands propagating llvm::Error to main, exitWithError,
exitWithErrorCode, and the LSan leak suppression workaround are no
longer needed.
Assisted-by: Gemini
---
llvm/tools/llvm-profdata/llvm-profdata.cpp | 31 ----------------------
1 file changed, 31 deletions(-)
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 4ff3d6667ac64..02bd24c394ef0 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -50,15 +50,6 @@
#include <cmath>
#include <optional>
-#if LLVM_ADDRESS_SANITIZER_BUILD || LLVM_HWADDRESS_SANITIZER_BUILD
-#include <sanitizer/lsan_interface.h>
-static int SkipLeakCheck;
-LLVM_ATTRIBUTE_USED int __lsan_is_turned_off() { return SkipLeakCheck; }
-static void skipLeakCheck() { SkipLeakCheck = 1; }
-#else
-static void skipLeakCheck() {}
-#endif
-
using namespace llvm;
using ProfCorrelatorKind = InstrProfCorrelator::ProfCorrelatorKind;
@@ -617,28 +608,6 @@ static int reportError(Error E) {
return 1;
}
-static void exitWithError(Twine Message, StringRef Whence = "",
- StringRef Hint = "") {
- reportError(makeError(Message, Whence, Hint));
- // exit() terminates without unwinding the stack or running destructors, and
- // there is no guaranty that pointers to allocations will be preserved, so
- // LSan reports in-flight heap allocations as leaks at atexit.
- skipLeakCheck();
- ::exit(1);
-}
-
-static void exitWithError(Error E, StringRef Whence = "") {
- reportError(makeError(std::move(E), Whence));
- skipLeakCheck();
- ::exit(1);
-}
-
-static void exitWithErrorCode(std::error_code EC, StringRef Whence = "") {
- reportError(makeError(EC, Whence));
- skipLeakCheck();
- ::exit(1);
-}
-
static Error warnOrErrorGivenError(FailureMode FailMode, std::error_code EC,
StringRef Whence = "") {
if (FailMode == failIfAnyAreInvalid)
More information about the llvm-branch-commits
mailing list