Changeset 233836 in webkit


Ignore:
Timestamp:
Jul 14, 2018 9:59:54 AM (6 years ago)
Author:
ddkilzer@apple.com
Message:

Replace TR2_OPTIONAL_ASSERTED_EXPRESSION macro in <wtf/Optional.h>
<https://webkit.org/b/187672>

Reviewed by Frédéric Wang.

  • wtf/Optional.h:

(std::optional::operator -> const):
(std::optional::operator * const):
(std::optional<T::operator-> const):
(std::optional<T::operator* const):

  • Replace TR2_OPTIONAL_ASSERTED_EXPRESSION macro with ASSERT_UNDER_CONSTEXPR_CONTEXT macro and return statement.
Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r233795 r233836  
     12018-07-14  David Kilzer  <ddkilzer@apple.com>
     2
     3        Replace TR2_OPTIONAL_ASSERTED_EXPRESSION macro in <wtf/Optional.h>
     4        <https://webkit.org/b/187672>
     5
     6        Reviewed by Frédéric Wang.
     7
     8        * wtf/Optional.h:
     9        (std::optional::operator -> const):
     10        (std::optional::operator * const):
     11        (std::optional<T::operator-> const):
     12        (std::optional<T::operator* const):
     13        - Replace TR2_OPTIONAL_ASSERTED_EXPRESSION macro with
     14          ASSERT_UNDER_CONSTEXPR_CONTEXT macro and return statement.
     15
    1162018-07-13  Mark Lam  <mark.lam@apple.com>
    217
  • trunk/Source/WTF/wtf/Optional.h

    r233577 r233836  
    236236}
    237237
    238 #if defined NDEBUG
    239 # define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) (EXPR)
    240 #else
    241 # define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) ((CHECK) ? (EXPR) : ([]{assert(!#CHECK);}(), (EXPR)))
    242 #endif
    243 
    244238
    245239// static_addressof: a constexpr version of addressof
     
    527521
    528522  constexpr T const* operator ->() const {
    529     return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), dataptr());
     523    ASSERT_UNDER_CONSTEXPR_CONTEXT(initialized());
     524    return dataptr();
    530525  }
    531526
     
    536531
    537532  constexpr T const& operator *() const& {
    538     return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), contained_val());
     533    ASSERT_UNDER_CONSTEXPR_CONTEXT(initialized());
     534    return contained_val();
    539535  }
    540536
     
    670666  // 20.5.5.3, observers
    671667  constexpr T* operator->() const {
    672     return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, ref);
     668    ASSERT_UNDER_CONSTEXPR_CONTEXT(ref);
     669    return ref;
    673670  }
    674671
    675672  constexpr T& operator*() const {
    676     return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, *ref);
     673    ASSERT_UNDER_CONSTEXPR_CONTEXT(ref);
     674    return *ref;
    677675  }
    678676
     
    10361034
    10371035# undef TR2_OPTIONAL_REQUIRES
    1038 # undef TR2_OPTIONAL_ASSERTED_EXPRESSION
    10391036
    10401037#endif // defined(__cpp_lib_optional)
Note: See TracChangeset for help on using the changeset viewer.