[llvm] [llvm][Support] Call clear_error in LockFileManager to avoid report_fatal_error (PR #83655)
Michael Spencer via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 20:02:20 PST 2024
https://github.com/Bigcheese created https://github.com/llvm/llvm-project/pull/83655
As per the comment in `raw_fd_ostream`'s destructor, you must call `clear_error()` to prevent a call to `report_fatal_error()`. There's not really a way to test this, but we did encounter it in the wild.
rdar://117347895
>From fe0b5161698b37e3183832863617abcd2084a90f Mon Sep 17 00:00:00 2001
From: Michael Spencer <bigcheesegs at gmail.com>
Date: Fri, 1 Mar 2024 19:39:23 -0800
Subject: [PATCH] [llvm][Support] Call clear_error in LockFileManager to avoid
report_fatal_error
As per the comment in `raw_fd_ostream`'s destructor, you must call
`clear_error()` to prevent a call to `report_fatal_error()`. There's
not really a way to test this, but we did encounter it in the wild.
rdar://117347895
---
llvm/lib/Support/LockFileManager.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp
index 34c7a16b24be41..facdc5a0d7d421 100644
--- a/llvm/lib/Support/LockFileManager.cpp
+++ b/llvm/lib/Support/LockFileManager.cpp
@@ -205,6 +205,8 @@ LockFileManager::LockFileManager(StringRef FileName)
S.append(std::string(UniqueLockFileName));
setError(Out.error(), S);
sys::fs::remove(UniqueLockFileName);
+ // Don't call report_fatal_error.
+ Out.clear_error();
return;
}
}
More information about the llvm-commits
mailing list