mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D23789 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279535 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -6,13 +6,21 @@
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Support/LockFileManager.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/Errc.h"
|
||||
#include "llvm/Support/ErrorOr.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Support/Signals.h"
|
||||
#include <cerrno>
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#if LLVM_ON_WIN32
|
||||
@@ -31,6 +39,7 @@
|
||||
#if USE_OSX_GETHOSTUUID
|
||||
#include <uuid/uuid.h>
|
||||
#endif
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
/// \brief Attempt to read the lock file with the given name, if it exists.
|
||||
@@ -112,6 +121,7 @@ bool LockFileManager::processStillExecuting(StringRef HostID, int PID) {
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
/// An RAII helper object ensure that the unique lock file is removed.
|
||||
///
|
||||
/// Ensures that if there is an error or a signal before we finish acquiring the
|
||||
@@ -127,6 +137,7 @@ public:
|
||||
: Filename(Name), RemoveImmediately(true) {
|
||||
sys::RemoveFileOnSignal(Filename, nullptr);
|
||||
}
|
||||
|
||||
~RemoveUniqueLockFileOnSignal() {
|
||||
if (!RemoveImmediately) {
|
||||
// Leave the signal handler enabled. It will be removed when the lock is
|
||||
@@ -136,8 +147,10 @@ public:
|
||||
sys::fs::remove(Filename);
|
||||
sys::DontRemoveFileOnSignal(Filename);
|
||||
}
|
||||
|
||||
void lockAcquired() { RemoveImmediately = false; }
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
LockFileManager::LockFileManager(StringRef FileName)
|
||||
@@ -202,7 +215,7 @@ LockFileManager::LockFileManager(StringRef FileName)
|
||||
// held since the .lock symlink will point to a nonexistent file.
|
||||
RemoveUniqueLockFileOnSignal RemoveUniqueFile(UniqueLockFileName);
|
||||
|
||||
while (1) {
|
||||
while (true) {
|
||||
// Create a link from the lock file name. If this succeeds, we're done.
|
||||
std::error_code EC =
|
||||
sys::fs::create_link(UniqueLockFileName, LockFileName);
|
||||
|
||||
Reference in New Issue
Block a user