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

Amy Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 20 14:34:34 PDT 2021


akhuang created this revision.
Herald added subscribers: dexonsmith, hiraditya.
akhuang requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Clang writes object files by first writing to a .tmp file and then renaming to the final .obj name. On Windows, if a compile is killed partway through the .tmp files don't get deleted.

Currently it seems like RemoveFileOnSignal takes care of deleting the
tmp files on Linux, but on Windows we need to call
setDeleteDisposition on tmp files so that they are deleted when
closed.

This patch uses llvm::sys::fs::TempFile to create these files on Windows.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102876

Files:
  clang/include/clang/Frontend/CompilerInstance.h
  clang/lib/Frontend/CompilerInstance.cpp
  llvm/include/llvm/Support/FileSystem.h
  llvm/lib/Support/Path.cpp
  llvm/lib/Support/Windows/Path.inc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102876.346857.patch
Type: text/x-patch
Size: 11220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210520/c5e5f833/attachment.bin>


More information about the llvm-commits mailing list