[cfe-commits] r130150 - /cfe/trunk/lib/Driver/Compilation.cpp

Daniel Dunbar daniel at zuster.org
Mon Apr 25 13:43:05 PDT 2011


Author: ddunbar
Date: Mon Apr 25 15:43:05 2011
New Revision: 130150

URL: http://llvm.org/viewvc/llvm-project?rev=130150&view=rev
Log:
Driver: When compilation fails, don't try to remove output files we don't have
write access to.

Modified:
    cfe/trunk/lib/Driver/Compilation.cpp

Modified: cfe/trunk/lib/Driver/Compilation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=130150&r1=130149&r2=130150&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Mon Apr 25 15:43:05 2011
@@ -101,6 +101,12 @@
     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





More information about the cfe-commits mailing list