[llvm] c4f5993 - [llvm][Support] Call clear_error in LockFileManager to avoid report_fatal_error (#83655)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 2 02:29:12 PST 2024
Author: Michael Spencer
Date: 2024-03-02T02:29:08-08:00
New Revision: c4f59937cae95a576635848b36a23b0d672f71d6
URL: https://github.com/llvm/llvm-project/commit/c4f59937cae95a576635848b36a23b0d672f71d6
DIFF: https://github.com/llvm/llvm-project/commit/c4f59937cae95a576635848b36a23b0d672f71d6.diff
LOG: [llvm][Support] Call clear_error in LockFileManager to avoid report_fatal_error (#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
Added:
Modified:
llvm/lib/Support/LockFileManager.cpp
Removed:
################################################################################
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