[clang] 0f0fd62 - [Basic] Use std::optional::value_or (NFC) (#140172)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 15 23:29:01 PDT 2025


Author: Kazu Hirata
Date: 2025-05-15T23:28:57-07:00
New Revision: 0f0fd6213e5cbf2276ee1fb23590e51ebe41810a

URL: https://github.com/llvm/llvm-project/commit/0f0fd6213e5cbf2276ee1fb23590e51ebe41810a
DIFF: https://github.com/llvm/llvm-project/commit/0f0fd6213e5cbf2276ee1fb23590e51ebe41810a.diff

LOG: [Basic] Use std::optional::value_or (NFC) (#140172)

Added: 
    

Modified: 
    clang/lib/Basic/Targets/SystemZ.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/SystemZ.cpp b/clang/lib/Basic/Targets/SystemZ.cpp
index ce532b72a89d1..13b86234eed79 100644
--- a/clang/lib/Basic/Targets/SystemZ.cpp
+++ b/clang/lib/Basic/Targets/SystemZ.cpp
@@ -188,8 +188,8 @@ void SystemZTargetInfo::getTargetDefines(const LangOptions &Opts,
     std::string Str("0x");
     unsigned int Librel = 0x40000000;
     Librel |= V.getMajor() << 24;
-    Librel |= (V.getMinor() ? V.getMinor().value() : 1) << 16;
-    Librel |= V.getSubminor() ? V.getSubminor().value() : 0;
+    Librel |= V.getMinor().value_or(1) << 16;
+    Librel |= V.getSubminor().value_or(0);
     Str += llvm::utohexstr(Librel);
 
     Builder.defineMacro("__TARGET_LIB__", Str.c_str());


        


More information about the cfe-commits mailing list