[lldb] [llvm] Modify the localCache API to require an explicit commit on CachedFile… (PR #115331)
Kyungwoo Lee via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 2 10:06:28 PST 2024
================
@@ -88,9 +89,10 @@ Expected<FileCache> llvm::localCache(const Twine &CacheNameRef,
AddBuffer(std::move(AddBuffer)), TempFile(std::move(TempFile)),
ModuleName(ModuleName), Task(Task) {}
- ~CacheStream() {
- // TODO: Manually commit rather than using non-trivial destructor,
- // allowing to replace report_fatal_errors with a return Error.
+ Error commit() override {
+ if (Committed)
+ return Error::success();
----------------
kyulee-com wrote:
Intuitively, this doesn't seem correct. Shouldn't we fail if we attempt to commit more than once, rather than just returning a success?
Additionally, I'm curious about what happens if we use this CacheStream after a commit has been called. I suspect it will fail, but do we provide a proper error message in this case? It would be ideal to have a test case to cover these scenarios.
https://github.com/llvm/llvm-project/pull/115331
More information about the llvm-commits
mailing list