[all-commits] [llvm/llvm-project] 9d070b: Recommit "Fix tmp files being left on Windows buil...

Amy Huang via All-commits all-commits at lists.llvm.org
Wed Jun 2 16:50:56 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9d070b2f4889887f9ce497592ef01df7b9601a1c
      https://github.com/llvm/llvm-project/commit/9d070b2f4889887f9ce497592ef01df7b9601a1c
  Author: Amy Huang <akhuang at google.com>
  Date:   2021-06-02 (Wed, 02 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:
  -----------
  Recommit "Fix tmp files being left on Windows builds." with a fix for
incorrect std::string use. (Also remove redundant call to
RemoveFileOnSignal.)

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

This reverts commit 20797b129f844d4b12ffb2b12cf33baa2d42985c.




More information about the All-commits mailing list