aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Path.cpp
diff options
context:
space:
mode:
authorAmy Huang <akhuang@google.com>2021-06-02 09:49:12 -0700
committerAmy Huang <akhuang@google.com>2021-06-02 16:50:37 -0700
commit9d070b2f4889887f9ce497592ef01df7b9601a1c (patch)
tree119b9464dc396cd324609dd35e33dc3893a4e88c /llvm/lib/Support/Path.cpp
parent87c43f3aa99d778755c7f5420e955885f855ecad (diff)
downloadllvm-9d070b2f4889887f9ce497592ef01df7b9601a1c.zip
llvm-9d070b2f4889887f9ce497592ef01df7b9601a1c.tar.gz
llvm-9d070b2f4889887f9ce497592ef01df7b9601a1c.tar.bz2
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.
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r--llvm/lib/Support/Path.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 005c27c3..d549b00 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -1229,7 +1229,7 @@ Error TempFile::keep(const Twine &Name) {
auto H = reinterpret_cast<HANDLE>(_get_osfhandle(FD));
std::error_code RenameEC = setDeleteDisposition(H, false);
if (!RenameEC) {
- RenameEC = rename_fd(FD, Name);
+ RenameEC = rename_handle(H, Name);
// If rename failed because it's cross-device, copy instead
if (RenameEC ==
std::error_code(ERROR_NOT_SAME_DEVICE, std::system_category())) {