Use the simpler version of sys::fs::remove when possible.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 10 Jan 2014 21:40:29 +0000 (21:40 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 10 Jan 2014 21:40:29 +0000 (21:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198958 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/FileUtilities.h
lib/Support/FileOutputBuffer.cpp
lib/Support/GraphWriter.cpp
lib/Support/LockFileManager.cpp
lib/Support/ToolOutputFile.cpp

index 79c59e4306c92b422abb1edd82753a53c3762886..873b8df30e04cd50388c72503e46fd0e193ce818 100644 (file)
@@ -51,8 +51,7 @@ namespace llvm {
     ~FileRemover() {
       if (DeleteIt) {
         // Ignore problems deleting the file.
-        bool existed;
-        sys::fs::remove(Filename.str(), existed);
+        sys::fs::remove(Filename.str());
       }
     }
 
@@ -62,8 +61,7 @@ namespace llvm {
     void setFile(const Twine& filename, bool deleteIt = true) {
       if (DeleteIt) {
         // Ignore problems deleting the file.
-        bool existed;
-        sys::fs::remove(Filename.str(), existed);
+        sys::fs::remove(Filename.str());
       }
 
       Filename.clear();
index ed084faed789e2d11c629ff6dfd1a6cafaacfba8..c01778f9600d6c7fccaaa4928db6ba1bf6fe1613 100644 (file)
@@ -28,8 +28,7 @@ FileOutputBuffer::FileOutputBuffer(mapped_file_region * R,
 }
 
 FileOutputBuffer::~FileOutputBuffer() {
-  bool Existed;
-  sys::fs::remove(Twine(TempPath), Existed);
+  sys::fs::remove(Twine(TempPath));
 }
 
 error_code FileOutputBuffer::create(StringRef FilePath,
@@ -57,8 +56,7 @@ error_code FileOutputBuffer::create(StringRef FilePath,
   }
 
   // Delete target file.
-  bool Existed;
-  EC = sys::fs::remove(FilePath, Existed);
+  EC = sys::fs::remove(FilePath);
   if (EC)
     return EC;
 
index 85be415dce07f17b8a7ae636c0191d0dc7507175..83aa25507f6460fe7fb37a789935d2e0bf21d550 100644 (file)
@@ -87,8 +87,7 @@ ExecGraphViewer(StringRef ExecPath, std::vector<const char*> &args,
       errs() << "Error: " << ErrMsg << "\n";
       return false;
     }
-    bool Existed;
-    sys::fs::remove(Filename, Existed);
+    sys::fs::remove(Filename);
     errs() << " done. \n";
   }
   else {
index eeec274ad8ee9069d1adb75c5a78ce6dee43145c..5f153a9f79596663b3d8fe3fe1588d2233924176 100644 (file)
@@ -111,8 +111,7 @@ LockFileManager::LockFileManager(StringRef FileName)
       // We failed to write out PID, so make up an excuse, remove the
       // unique lock file, and fail.
       Error = make_error_code(errc::no_space_on_device);
-      bool Existed;
-      sys::fs::remove(UniqueLockFileName.c_str(), Existed);
+      sys::fs::remove(UniqueLockFileName.c_str());
       return;
     }
   }
@@ -137,14 +136,13 @@ LockFileManager::LockFileManager(StringRef FileName)
 
   // Someone else managed to create the lock file first. Wipe out our unique
   // lock file (it's useless now) and read the process ID from the lock file.
-  bool Existed;
-  sys::fs::remove(UniqueLockFileName.str(), Existed);
+  sys::fs::remove(UniqueLockFileName.str());
   if ((Owner = readLockFile(LockFileName)))
     return;
 
   // There is a lock file that nobody owns; try to clean it up and report
   // an error.
-  sys::fs::remove(LockFileName.str(), Existed);
+  sys::fs::remove(LockFileName.str());
   Error = EC;
 }
 
@@ -163,9 +161,8 @@ LockFileManager::~LockFileManager() {
     return;
 
   // Since we own the lock, remove the lock file and our own unique lock file.
-  bool Existed;
-  sys::fs::remove(LockFileName.str(), Existed);
-  sys::fs::remove(UniqueLockFileName.str(), Existed);
+  sys::fs::remove(LockFileName.str());
+  sys::fs::remove(UniqueLockFileName.str());
 }
 
 void LockFileManager::waitForUnlock() {
index 5c1268a40a960ded80356894e31fecfca15169c5..b5fb20f4b20f3b9cf8c0777f0090856540a8b7a4 100644 (file)
@@ -25,10 +25,8 @@ tool_output_file::CleanupInstaller::CleanupInstaller(const char *filename)
 
 tool_output_file::CleanupInstaller::~CleanupInstaller() {
   // Delete the file if the client hasn't told us not to.
-  if (!Keep && Filename != "-") {
-    bool Existed;
-    sys::fs::remove(Filename, Existed);
-  }
+  if (!Keep && Filename != "-")
+    sys::fs::remove(Filename);
 
   // Ok, the file is successfully written and closed, or deleted. There's no
   // further need to clean it up on signals.