llvm.org GIT mirror llvm / 3348c6d
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318111 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 2 years ago
2 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
5555 SmallString<128> UniqueLockFileName;
5656
5757 Optional > Owner;
58 Optional Error;
58 std::error_code ErrorCode;
5959 std::string ErrorDiagMsg;
6060
6161 LockFileManager(const LockFileManager &) = delete;
8888
8989 /// \brief Set error and error message
9090 void setError(const std::error_code &EC, StringRef ErrorMsg = "") {
91 Error = EC;
91 ErrorCode = EC;
9292 ErrorDiagMsg = ErrorMsg.str();
9393 }
9494 };
260260 if (Owner)
261261 return LFS_Shared;
262262
263 if (Error)
263 if (ErrorCode)
264264 return LFS_Error;
265265
266266 return LFS_Owned;
267267 }
268268
269269 std::string LockFileManager::getErrorMessage() const {
270 if (Error) {
270 if (ErrorCode) {
271271 std::string Str(ErrorDiagMsg);
272 std::string ErrCodeMsg = Error->message();
272 std::string ErrCodeMsg = ErrorCode.message();
273273 raw_string_ostream OSS(Str);
274274 if (!ErrCodeMsg.empty())
275275 OSS << ": " << ErrCodeMsg;