[all-commits] [llvm/llvm-project] 7daa18: Fix tmp files being left on Windows builds.

Amy Huang via All-commits all-commits at lists.llvm.org
Tue Jun 1 17:14:21 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7daa18215905c831e130c7542f17619e9d936dfc
      https://github.com/llvm/llvm-project/commit/7daa18215905c831e130c7542f17619e9d936dfc
  Author: Amy Huang <akhuang at google.com>
  Date:   2021-06-01 (Tue, 01 Jun 2021)

  Changed paths:
    M clang/include/clang/Frontend/CompilerInstance.h
    M clang/lib/Frontend/CompilerInstance.cpp
    M llvm/lib/Support/Path.cpp
    M llvm/lib/Support/Windows/Path.inc

  Log Message:
  -----------
  Fix tmp files being left on Windows builds.

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 switches to using TempFile to create the .tmp files we write
when creating object files, since it uses setDeleteDisposition on Windows.
This change applies to both Linux and Windows for consistency.

Differential Revision: https://reviews.llvm.org/D102876




More information about the All-commits mailing list