[llvm] 93c761f - [llvm-libtool-darwin] Use Optional operator overloads. NFC

Shoaib Meenai via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 15 11:43:16 PDT 2020


Author: Shoaib Meenai
Date: 2020-08-15T11:41:57-07:00
New Revision: 93c761f5e5b05c8ee54062f43d9c34bb75a0c2bb

URL: https://github.com/llvm/llvm-project/commit/93c761f5e5b05c8ee54062f43d9c34bb75a0c2bb
DIFF: https://github.com/llvm/llvm-project/commit/93c761f5e5b05c8ee54062f43d9c34bb75a0c2bb.diff

LOG: [llvm-libtool-darwin] Use Optional operator overloads. NFC

Use operator bool instead of hasValue and operator* instead of getValue
to simplify the code slightly.

Added: 
    

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

Removed: 
    


################################################################################
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<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());


        


More information about the llvm-commits mailing list