]> granicus.if.org Git - clang/commit
[Driver] Clean up tmp files when deleting Compilation objects
authorDavid Stenberg <david.stenberg@ericsson.com>
Thu, 31 May 2018 09:05:22 +0000 (09:05 +0000)
committerDavid Stenberg <david.stenberg@ericsson.com>
Thu, 31 May 2018 09:05:22 +0000 (09:05 +0000)
commite0d354c65c7cddcc7365be534c748c13052fd6db
tree2339afaa31e40706172880d61d52e9ac6e7935f8
parentae5140072b20e79fa8d575b5e11813adf581ea52
[Driver] Clean up tmp files when deleting Compilation objects

Summary:
In rL327851 the createUniqueFile() and createTemporaryFile()
variants that do not return the file descriptors were changed to
create empty files, rather than only check if the paths are free.
This change was done in order to make the functions race-free.

That change led to clang-tidy (and possibly other tools) leaving
behind temporary assembly files, of the form placeholder-*, when
using a target that does not support the internal assembler.

The temporary files are created when building the Compilation
object in stripPositionalArgs(), as a part of creating the
compilation database for the arguments after the double-dash. The
files are created by Driver::GetNamedOutputPath().

Fix this issue by cleaning out temporary files at the deletion of
Compilation objects.

This fixes https://bugs.llvm.org/show_bug.cgi?id=37091.

Reviewers: klimek, sepavloff, arphaman, aaron.ballman, john.brawn, mehdi_amini, sammccall, bkramer, alexfh, JDevlieghere

Reviewed By: aaron.ballman, JDevlieghere

Subscribers: erichkeane, lebedev.ri, Ka-Ka, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333637 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Driver/Compilation.h
lib/Driver/Compilation.cpp
lib/Driver/Driver.cpp