diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp index a91f783519d4..e861b469419f 100644 --- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp +++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp @@ -108,10 +108,10 @@ static Expected searchForFile(const Twine &FileName) { }; Optional Found = FindLib(LibrarySearchDirs); - if (!Found.hasValue()) + if (!Found) Found = FindLib(StandardSearchDirs); - if (Found.hasValue()) - return Found.getValue(); + if (Found) + return *Found; return createStringError(std::errc::invalid_argument, "cannot locate file '%s'", FileName.str().c_str());