summaryrefslogtreecommitdiff
path: root/include/llvm/Support/LockFileManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Support/LockFileManager.h')
-rw-r--r--include/llvm/Support/LockFileManager.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/llvm/Support/LockFileManager.h b/include/llvm/Support/LockFileManager.h
index 8e88d4279bd87..13d252425b93a 100644
--- a/include/llvm/Support/LockFileManager.h
+++ b/include/llvm/Support/LockFileManager.h
@@ -11,11 +11,12 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/StringRef.h"
#include <system_error>
#include <utility> // for std::pair
namespace llvm {
+class StringRef;
+
/// \brief Class that manages the creation of a lock file to aid
/// implicit coordination between different processes.
///
@@ -56,6 +57,7 @@ private:
Optional<std::pair<std::string, int> > Owner;
Optional<std::error_code> Error;
+ std::string ErrorDiagMsg;
LockFileManager(const LockFileManager &) = delete;
LockFileManager &operator=(const LockFileManager &) = delete;
@@ -81,6 +83,15 @@ public:
/// \brief Remove the lock file. This may delete a different lock file than
/// the one previously read if there is a race.
std::error_code unsafeRemoveLockFile();
+
+ /// \brief Get error message, or "" if there is no error.
+ std::string getErrorMessage() const;
+
+ /// \brief Set error and error message
+ void setError(std::error_code &EC, StringRef ErrorMsg = "") {
+ Error = EC;
+ ErrorDiagMsg = ErrorMsg.str();
+ }
};
} // end namespace llvm