[llvm] [llvm][Support] Call clear_error in LockFileManager to avoid report_fatal_error (PR #83655)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 20:02:57 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-support
Author: Michael Spencer (Bigcheese)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/83655.diff
1 Files Affected:
- (modified) llvm/lib/Support/LockFileManager.cpp (+2)
``````````diff
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;
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/83655
More information about the llvm-commits
mailing list