From bca07a4524feb4edec581062d631a13116320a24 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 20 Feb 2011 13:06:31 +0000 Subject: Vendor import of clang trunk r126079: http://llvm.org/svn/llvm-project/cfe/trunk@126079 --- lib/Driver/Compilation.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'lib/Driver/Compilation.cpp') diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp index c059afd45439..5619212d38bb 100644 --- a/lib/Driver/Compilation.cpp +++ b/lib/Driver/Compilation.cpp @@ -1,4 +1,4 @@ -//===--- Compilation.cpp - Compilation Task Implementation --------------*-===// +//===--- Compilation.cpp - Compilation Task Implementation ----------------===// // // The LLVM Compiler Infrastructure // @@ -17,7 +17,7 @@ #include "clang/Driver/ToolChain.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/System/Program.h" +#include "llvm/Support/Program.h" #include #include using namespace clang::driver; @@ -101,21 +101,15 @@ bool Compilation::CleanupFileList(const ArgStringList &Files, llvm::sys::Path P(*it); std::string Error; - if (!P.isRegularFile()) { - // If we have a special file in our list, i.e. /dev/null - // then don't call eraseFromDisk() and just continue. - continue; - } - if (P.eraseFromDisk(false, &Error)) { - // Failure is only failure if the file doesn't exist. There is a - // race condition here due to the limited interface of - // llvm::sys::Path, we want to know if the removal gave E_NOENT. + // Failure is only failure if the file exists and is "regular". There is + // a race condition here due to the limited interface of + // llvm::sys::Path, we want to know if the removal gave ENOENT. // FIXME: Grumble, P.exists() is broken. PR3837. struct stat buf; - if (::stat(P.c_str(), &buf) == 0 - || errno != ENOENT) { + if (::stat(P.c_str(), &buf) == 0 ? (buf.st_mode & S_IFMT) == S_IFREG : + (errno != ENOENT)) { if (IssueErrors) getDriver().Diag(clang::diag::err_drv_unable_to_remove_file) << Error; -- cgit v1.3