[PATCH] D102736: Fix tmp files being left on Windows builds.

Adrian McCarthy via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 19 12:07:48 PDT 2021


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



More information about the cfe-commits mailing list