From 248ced2efa66e665bfab9e161b2b231f6fef16c6 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 13 Feb 2014 04:00:35 +0000 Subject: [PATCH] Use simpler version of sys::fs::exists when possible. llvm-svn: 201289 --- lib/Support/LockFileManager.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Support/LockFileManager.cpp b/lib/Support/LockFileManager.cpp index 5f153a9f795..c7c51e646b1 100644 --- a/lib/Support/LockFileManager.cpp +++ b/lib/Support/LockFileManager.cpp @@ -31,8 +31,7 @@ Optional > LockFileManager::readLockFile(StringRef LockFileName) { // Check whether the lock file exists. If not, clearly there's nothing // to read, so we just return. - bool Exists = false; - if (sys::fs::exists(LockFileName, Exists) || !Exists) + if (!sys::fs::exists(LockFileName)) return None; // Read the owning host and PID out of the lock file. If it appears that the @@ -189,23 +188,22 @@ void LockFileManager::waitForUnlock() { #else nanosleep(&Interval, NULL); #endif - bool Exists = false; bool LockFileJustDisappeared = false; // If the lock file is still expected to be there, check whether it still // is. if (!LockFileGone) { + bool Exists; if (!sys::fs::exists(LockFileName.str(), Exists) && !Exists) { LockFileGone = true; LockFileJustDisappeared = true; - Exists = false; } } // If the lock file is no longer there, check if the original file is // available now. if (LockFileGone) { - if (!sys::fs::exists(FileName.str(), Exists) && Exists) { + if (sys::fs::exists(FileName.str())) { return; }