[cfe-commits] r173215 - in /cfe/trunk: lib/Driver/Compilation.cpp test/Driver/output-file-is-dir.c

Daniel Dunbar daniel at zuster.org
Tue Jan 22 17:08:23 PST 2013


Author: ddunbar
Date: Tue Jan 22 19:08:23 2013
New Revision: 173215

URL: http://llvm.org/viewvc/llvm-project?rev=173215&view=rev
Log:
[Driver] Don't remove non-regular files that were outputs.

Added:
    cfe/trunk/test/Driver/output-file-is-dir.c
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=173215&r1=173214&r2=173215&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Tue Jan 22 19:08:23 2013
@@ -210,9 +210,9 @@
     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)) {

Added: cfe/trunk/test/Driver/output-file-is-dir.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/output-file-is-dir.c?rev=173215&view=auto
==============================================================================
--- cfe/trunk/test/Driver/output-file-is-dir.c (added)
+++ cfe/trunk/test/Driver/output-file-is-dir.c Tue Jan 22 19:08:23 2013
@@ -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; }





More information about the cfe-commits mailing list