]> granicus.if.org Git - clang/commitdiff
Use llvm::sys::fs::can_write.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 18 Jun 2013 20:58:25 +0000 (20:58 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 18 Jun 2013 20:58:25 +0000 (20:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184234 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Compilation.cpp
lib/Frontend/CompilerInstance.cpp

index ef40ae4afbb6abc0ede65378fe06f5fed3c01038..32d687e5ca8ff17c4f786cb457108c850e06b977 100644 (file)
@@ -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 *File, bool IssueErrors) const {
   // 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)) {
index 66c79d0e9e44a9432e62576b3bb738e75643b5b2..a2872dd4f20dc5e60203781a74a5b939e363a9f6 100644 (file)
@@ -535,7 +535,8 @@ CompilerInstance::createOutputFile(StringRef OutputPath,
     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;