[llvm] 5d7e63f - [ADT] Rename value to alt (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 19 12:00:09 PDT 2022


Author: Kazu Hirata
Date: 2022-06-19T12:00:03-07:00
New Revision: 5d7e63fb4f26276faa694cefd53331fc41a00e16

URL: https://github.com/llvm/llvm-project/commit/5d7e63fb4f26276faa694cefd53331fc41a00e16
DIFF: https://github.com/llvm/llvm-project/commit/5d7e63fb4f26276faa694cefd53331fc41a00e16.diff

LOG: [ADT] Rename value to alt (NFC)

This patch renames value to alt so that the parameter won't collide
with member function value().

Added: 
    

Modified: 
    llvm/include/llvm/ADT/Optional.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/Optional.h b/llvm/include/llvm/ADT/Optional.h
index b222339fd309..2f458d5be4b8 100644
--- a/llvm/include/llvm/ADT/Optional.h
+++ b/llvm/include/llvm/ADT/Optional.h
@@ -315,11 +315,11 @@ template <typename T> class Optional {
   constexpr const T &operator*() const & { return getValue(); }
   T &operator*() & { return getValue(); }
 
-  template <typename U> constexpr T value_or(U &&value) const & {
-    return hasValue() ? getValue() : std::forward<U>(value);
+  template <typename U> constexpr T value_or(U &&alt) const & {
+    return hasValue() ? getValue() : std::forward<U>(alt);
   }
-  template <typename U> constexpr T getValueOr(U &&value) const & {
-    return hasValue() ? getValue() : std::forward<U>(value);
+  template <typename U> constexpr T getValueOr(U &&alt) const & {
+    return hasValue() ? getValue() : std::forward<U>(alt);
   }
 
   /// Apply a function to the value if present; otherwise return None.
@@ -334,11 +334,11 @@ template <typename T> class Optional {
   T &&getValue() && { return std::move(Storage.getValue()); }
   T &&operator*() && { return std::move(Storage.getValue()); }
 
-  template <typename U> T value_or(U &&value) && {
-    return hasValue() ? std::move(getValue()) : std::forward<U>(value);
+  template <typename U> T value_or(U &&alt) && {
+    return hasValue() ? std::move(getValue()) : std::forward<U>(alt);
   }
-  template <typename U> T getValueOr(U &&value) && {
-    return hasValue() ? std::move(getValue()) : std::forward<U>(value);
+  template <typename U> T getValueOr(U &&alt) && {
+    return hasValue() ? std::move(getValue()) : std::forward<U>(alt);
   }
 
   /// Apply a function to the value if present; otherwise return None.


        


More information about the llvm-commits mailing list