[llvm-libtool-darwin] Use Optional operator overloads. NFC
authorShoaib Meenai <smeenai@fb.com>
Sat, 15 Aug 2020 18:41:57 +0000 (11:41 -0700)
committerShoaib Meenai <smeenai@fb.com>
Sat, 15 Aug 2020 18:41:57 +0000 (11:41 -0700)
Use operator bool instead of hasValue and operator* instead of getValue
to simplify the code slightly.

llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp

index a91f783..e861b46 100644 (file)
@@ -108,10 +108,10 @@ static Expected<std::string> searchForFile(const Twine &FileName) {
   };
 
   Optional<std::string> 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());