r184234 - Use llvm::sys::fs::can_write.

Rafael Espindola rafael.espindola at gmail.com
Tue Jun 18 13:58:25 PDT 2013


Author: rafael
Date: Tue Jun 18 15:58:25 2013
New Revision: 184234

URL: http://llvm.org/viewvc/llvm-project?rev=184234&view=rev
Log:
Use llvm::sys::fs::can_write.

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

Modified: cfe/trunk/lib/Driver/Compilation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=184234&r1=184233&r2=184234&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Tue Jun 18 15:58:25 2013
@@ -16,6 +16,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/PathV1.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/raw_ostream.h"
@@ -208,7 +209,7 @@ bool Compilation::CleanupFile(const char
   // Don't try to remove files which we don't have write access to (but may be
   // able to remove), or non-regular files. Underlying tools may have
   // intentionally not overwritten them.
-  if (!P.canWrite() || !P.isRegularFile())
+  if (!llvm::sys::fs::can_write(File) || !P.isRegularFile())
     return true;
 
   if (P.eraseFromDisk(false, &Error)) {

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=184234&r1=184233&r2=184234&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Tue Jun 18 15:58:25 2013
@@ -535,7 +535,8 @@ CompilerInstance::createOutputFile(Strin
     bool Exists;
     if ((CreateMissingDirectories || ParentExists) &&
         ((llvm::sys::fs::exists(AbsPath.str(), Exists) || !Exists) ||
-         (OutPath.isRegularFile() && OutPath.canWrite()))) {
+         (OutPath.isRegularFile() &&
+          llvm::sys::fs::can_write(AbsPath.c_str())))) {
       // Create a temporary file.
       SmallString<128> TempPath;
       TempPath = OutFile;





More information about the cfe-commits mailing list