[llvm] r198958 - Use the simpler version of sys::fs::remove when possible.
Rafael Espindola
rafael.espindola at gmail.com
Fri Jan 10 13:40:29 PST 2014
Author: rafael
Date: Fri Jan 10 15:40:29 2014
New Revision: 198958
URL: http://llvm.org/viewvc/llvm-project?rev=198958&view=rev
Log:
Use the simpler version of sys::fs::remove when possible.
Modified:
llvm/trunk/include/llvm/Support/FileUtilities.h
llvm/trunk/lib/Support/FileOutputBuffer.cpp
llvm/trunk/lib/Support/GraphWriter.cpp
llvm/trunk/lib/Support/LockFileManager.cpp
llvm/trunk/lib/Support/ToolOutputFile.cpp
Modified: llvm/trunk/include/llvm/Support/FileUtilities.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileUtilities.h?rev=198958&r1=198957&r2=198958&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/FileUtilities.h (original)
+++ llvm/trunk/include/llvm/Support/FileUtilities.h Fri Jan 10 15:40:29 2014
@@ -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();
Modified: llvm/trunk/lib/Support/FileOutputBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FileOutputBuffer.cpp?rev=198958&r1=198957&r2=198958&view=diff
==============================================================================
--- llvm/trunk/lib/Support/FileOutputBuffer.cpp (original)
+++ llvm/trunk/lib/Support/FileOutputBuffer.cpp Fri Jan 10 15:40:29 2014
@@ -28,8 +28,7 @@ FileOutputBuffer::FileOutputBuffer(mappe
}
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(Stri
}
// Delete target file.
- bool Existed;
- EC = sys::fs::remove(FilePath, Existed);
+ EC = sys::fs::remove(FilePath);
if (EC)
return EC;
Modified: llvm/trunk/lib/Support/GraphWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/GraphWriter.cpp?rev=198958&r1=198957&r2=198958&view=diff
==============================================================================
--- llvm/trunk/lib/Support/GraphWriter.cpp (original)
+++ llvm/trunk/lib/Support/GraphWriter.cpp Fri Jan 10 15:40:29 2014
@@ -87,8 +87,7 @@ ExecGraphViewer(StringRef ExecPath, std:
errs() << "Error: " << ErrMsg << "\n";
return false;
}
- bool Existed;
- sys::fs::remove(Filename, Existed);
+ sys::fs::remove(Filename);
errs() << " done. \n";
}
else {
Modified: llvm/trunk/lib/Support/LockFileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/LockFileManager.cpp?rev=198958&r1=198957&r2=198958&view=diff
==============================================================================
--- llvm/trunk/lib/Support/LockFileManager.cpp (original)
+++ llvm/trunk/lib/Support/LockFileManager.cpp Fri Jan 10 15:40:29 2014
@@ -111,8 +111,7 @@ LockFileManager::LockFileManager(StringR
// 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(StringR
// 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() {
Modified: llvm/trunk/lib/Support/ToolOutputFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ToolOutputFile.cpp?rev=198958&r1=198957&r2=198958&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ToolOutputFile.cpp (original)
+++ llvm/trunk/lib/Support/ToolOutputFile.cpp Fri Jan 10 15:40:29 2014
@@ -25,10 +25,8 @@ tool_output_file::CleanupInstaller::Clea
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.
More information about the llvm-commits
mailing list