diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-04-25 20:43:05 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-04-25 20:43:05 +0000 |
commit | 462e7ed4976899823488ae4fa699a2b48451f54f (patch) | |
tree | 9e13a9a8a90812a7be84bdbf660f00124c8985cd /clang/lib/Driver/Compilation.cpp | |
parent | f03406f103392d444e11fe455ef895c24eba4025 (diff) | |
download | bcm5719-llvm-462e7ed4976899823488ae4fa699a2b48451f54f.tar.gz bcm5719-llvm-462e7ed4976899823488ae4fa699a2b48451f54f.zip |
Driver: When compilation fails, don't try to remove output files we don't have
write access to.
llvm-svn: 130150
Diffstat (limited to 'clang/lib/Driver/Compilation.cpp')
-rw-r--r-- | clang/lib/Driver/Compilation.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp index 5619212d38b..2657faa0d3a 100644 --- a/clang/lib/Driver/Compilation.cpp +++ b/clang/lib/Driver/Compilation.cpp @@ -101,6 +101,12 @@ bool Compilation::CleanupFileList(const ArgStringList &Files, llvm::sys::Path P(*it); 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()) + continue; + if (P.eraseFromDisk(false, &Error)) { // Failure is only failure if the file exists and is "regular". There is // a race condition here due to the limited interface of |