================
@@ -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();
----------------
anjenner wrote:

Fair enough. My thinking was that commit() would be idempotent and calling it a 
second time would be harmless. But I understand the potential for confusion so 
I'll make it fail instead. After commit() has been called, the OS member will 
have been reset() and I think will cause the any calling code to do a pure 
virtual function call if it tries to write to it. I'll have a think about how 
we could better there and make a testcase. Probably setting OS to a 
raw_fd_ostream with an fd of zero instead of a default-constructed 
raw_pwrite_ostream would give a better error message.

https://github.com/llvm/llvm-project/pull/115331
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to