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

Amy Huang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 19 14:26:35 PDT 2021


akhuang added a comment.

In D102736#2769358 <https://reviews.llvm.org/D102736#2769358>, @amccarth wrote:

> 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.

So, there is a `TempFile` class in `llvm::support::fs` with create temp file and keep temp file operations, and it would be nice to use that. The issue I was running into is that it uses a file descriptor (`int fd`) to keep track of the file, but for some reason, the function to convert the fd to a handle (`_get_osfhandle`) was not working (exits the program when called). I haven't yet figured out why this is happening


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