[Driver] Don't remove non-regular files that were outputs.

llvm-svn: 173215
This commit is contained in:
Daniel Dunbar 2013-01-23 01:08:23 +00:00
parent 430fa9bfb3
commit 582b2ab0dd
2 changed files with 9 additions and 3 deletions

View File

@ -210,9 +210,9 @@ bool Compilation::CleanupFileList(const ArgStringList &Files,
std::string Error;
// Don't try to remove files which we don't have write access to (but may be
// able to remove). Underlying tools may have intentionally not overwritten
// them.
if (!P.canWrite())
// able to remove), or non-regular files. Underlying tools may have
// intentionally not overwritten them.
if (!P.canWrite() || !P.isRegularFile())
continue;
if (P.eraseFromDisk(false, &Error)) {

View File

@ -0,0 +1,6 @@
// RUN: rm -rf %t.dir
// RUN: mkdir -p %t.dir/a.out
// RUN: cd %t.dir && not %clang %s
// RUN: test -d %t.dir/a.out
int main() { return 0; }