[llvm] r318111 - Simplify and rename variable.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 13 15:32:19 PST 2017
Author: rafael
Date: Mon Nov 13 15:32:19 2017
New Revision: 318111
URL: http://llvm.org/viewvc/llvm-project?rev=318111&view=rev
Log:
Simplify and rename variable.
std::error_code can represent success, so we don't need a
Optional<std::error_code>.
Rename the variable to avoid confusion with the type Error.
Modified:
llvm/trunk/include/llvm/Support/LockFileManager.h
llvm/trunk/lib/Support/LockFileManager.cpp
Modified: llvm/trunk/include/llvm/Support/LockFileManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/LockFileManager.h?rev=318111&r1=318110&r2=318111&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/LockFileManager.h (original)
+++ llvm/trunk/include/llvm/Support/LockFileManager.h Mon Nov 13 15:32:19 2017
@@ -56,7 +56,7 @@ private:
SmallString<128> UniqueLockFileName;
Optional<std::pair<std::string, int> > Owner;
- Optional<std::error_code> Error;
+ std::error_code ErrorCode;
std::string ErrorDiagMsg;
LockFileManager(const LockFileManager &) = delete;
@@ -89,7 +89,7 @@ public:
/// \brief Set error and error message
void setError(const std::error_code &EC, StringRef ErrorMsg = "") {
- Error = EC;
+ ErrorCode = EC;
ErrorDiagMsg = ErrorMsg.str();
}
};
Modified: llvm/trunk/lib/Support/LockFileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/LockFileManager.cpp?rev=318111&r1=318110&r2=318111&view=diff
==============================================================================
--- llvm/trunk/lib/Support/LockFileManager.cpp (original)
+++ llvm/trunk/lib/Support/LockFileManager.cpp Mon Nov 13 15:32:19 2017
@@ -261,16 +261,16 @@ LockFileManager::LockFileState LockFileM
if (Owner)
return LFS_Shared;
- if (Error)
+ if (ErrorCode)
return LFS_Error;
return LFS_Owned;
}
std::string LockFileManager::getErrorMessage() const {
- if (Error) {
+ if (ErrorCode) {
std::string Str(ErrorDiagMsg);
- std::string ErrCodeMsg = Error->message();
+ std::string ErrCodeMsg = ErrorCode.message();
raw_string_ostream OSS(Str);
if (!ErrCodeMsg.empty())
OSS << ": " << ErrCodeMsg;
More information about the llvm-commits
mailing list