]> granicus.if.org Git - clang/commitdiff
Use the simpler version of llvm::sys::fs::remove when possible.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 10 Jan 2014 21:32:14 +0000 (21:32 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 10 Jan 2014 21:32:14 +0000 (21:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198957 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ARCMigrate/FileRemapper.cpp
lib/Frontend/ASTUnit.cpp
lib/Frontend/CompilerInstance.cpp
lib/Frontend/DependencyFile.cpp
lib/Rewrite/Core/Rewriter.cpp
lib/Serialization/GlobalModuleIndex.cpp

index a14226e43fe0bb25da2c28964685a9fd323b9115..e406d47c0258447eaaa965ac235214f3bc8e4ff2 100644 (file)
@@ -36,8 +36,7 @@ void FileRemapper::clear(StringRef outputDir) {
   assert(ToFromMappings.empty());
   if (!outputDir.empty()) {
     std::string infoFile = getRemapInfoFile(outputDir);
-    bool existed;
-    llvm::sys::fs::remove(infoFile, existed);
+    llvm::sys::fs::remove(infoFile);
   }
 }
 
index 4f761f4c9bc8869d0e0eb8f04fc1ffb2e8799022..983045565f960833e00ffb4e9a1c66aea6dbbf93 100644 (file)
@@ -2591,8 +2591,7 @@ bool ASTUnit::Save(StringRef File) {
   }
 
   if (llvm::sys::fs::rename(TempPath.str(), File)) {
-    bool exists;
-    llvm::sys::fs::remove(TempPath.str(), exists);
+    llvm::sys::fs::remove(TempPath.str());
     return true;
   }
 
index 48ba0056071044b3c1b17de96fe19c8de77a41ba..e311465cba1ade4e651c4f247b6f2ca596ec6dd2 100644 (file)
@@ -432,8 +432,7 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) {
     delete it->OS;
     if (!it->TempFilename.empty()) {
       if (EraseFiles) {
-        bool existed;
-        llvm::sys::fs::remove(it->TempFilename, existed);
+        llvm::sys::fs::remove(it->TempFilename);
       } else {
         SmallString<128> NewOutFile(it->Filename);
 
@@ -445,8 +444,7 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) {
           getDiagnostics().Report(diag::err_unable_to_rename_temp)
             << it->TempFilename << it->Filename << ec.message();
 
-          bool existed;
-          llvm::sys::fs::remove(it->TempFilename, existed);
+          llvm::sys::fs::remove(it->TempFilename);
         }
       }
     } else if (!it->Filename.empty() && EraseFiles)
@@ -1091,10 +1089,8 @@ static void pruneModuleCache(const HeaderSearchOptions &HSOpts) {
 
     // If we removed all of the files in the directory, remove the directory
     // itself.
-    if (RemovedAllFiles) {
-      bool Existed;
-      llvm::sys::fs::remove(Dir->path(), Existed);
-    }
+    if (RemovedAllFiles)
+      llvm::sys::fs::remove(Dir->path());
   }
 }
 
index 4037af9055d57a6e462d0e388bc3283f11defbb3..1e3aba7254c9449bd3d343c97aa554cef7904e5e 100644 (file)
@@ -166,8 +166,7 @@ static void PrintFilename(raw_ostream &OS, StringRef Filename) {
 
 void DependencyFileCallback::OutputDependencyFile() {
   if (SeenMissingHeader) {
-    bool existed;
-    llvm::sys::fs::remove(OutputFile, existed);
+    llvm::sys::fs::remove(OutputFile);
     return;
   }
 
index 51af83954c5a821ebc4f99416f33e2573b183e4f..9bcb264597cfac652faef48c86cad9973c2f7f4c 100644 (file)
@@ -458,10 +458,9 @@ public:
       AllWritten = false;
       Diagnostics.Report(clang::diag::err_unable_to_rename_temp)
         << TempFilename << Filename << ec.message();
-      bool existed;
       // If the remove fails, there's not a lot we can do - this is already an
       // error.
-      llvm::sys::fs::remove(TempFilename.str(), existed);
+      llvm::sys::fs::remove(TempFilename.str());
     }
   }
 
index fb647b0be9bcc4e864fbb27e9722ddd275495aef..fcdf5f5a8d9854bf5685508255defe5b56e706ef 100644 (file)
@@ -807,13 +807,12 @@ GlobalModuleIndex::writeIndex(FileManager &FileMgr, StringRef Path) {
     return EC_IOError;
 
   // Remove the old index file. It isn't relevant any more.
-  bool OldIndexExisted;
-  llvm::sys::fs::remove(IndexPath.str(), OldIndexExisted);
+  llvm::sys::fs::remove(IndexPath.str());
 
   // Rename the newly-written index file to the proper name.
   if (llvm::sys::fs::rename(IndexTmpPath.str(), IndexPath.str())) {
     // Rename failed; just remove the 
-    llvm::sys::fs::remove(IndexTmpPath.str(), OldIndexExisted);
+    llvm::sys::fs::remove(IndexTmpPath.str());
     return EC_IOError;
   }