amccarth added a comment.

At some point, the duplicate handle must be closed.  I don't see that 
happening.  I've added an inline comment where I think it should be done.

(I find it weird that duplicating the handle seems necessary.)

At a high level, it seems a shame that `llvm::support::fs` doesn't have 
create-temporary-file and keep-temporary-file operations to hide all this 
detail from the frontend.



================
Comment at: clang/lib/Frontend/CompilerInstance.cpp:721
+    llvm::sys::fs::UnmarkFileForDeletion(OF.Handle);
+
     // If '-working-directory' was passed, the output filename should be
----------------
IIUC, OF.Handle is the duplicate handle, and we're done with it at this point.  
It should be closed, before doing things like trying to rename/move the file.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102736/new/

https://reviews.llvm.org/D102736

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to