This is an archive of the discontinued LLVM Phabricator instance.

Fix tmp files being left on Windows builds.
AbandonedPublic

Authored by akhuang on May 20 2021, 2:34 PM.

Details

Summary

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.

Diff Detail