Changeset 233836 in webkit
- Timestamp:
- Jul 14, 2018 9:59:54 AM (6 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r233795 r233836 1 2018-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 1 16 2018-07-13 Mark Lam <mark.lam@apple.com> 2 17 -
trunk/Source/WTF/wtf/Optional.h
r233577 r233836 236 236 } 237 237 238 #if defined NDEBUG239 # define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) (EXPR)240 #else241 # define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) ((CHECK) ? (EXPR) : ([]{assert(!#CHECK);}(), (EXPR)))242 #endif243 244 238 245 239 // static_addressof: a constexpr version of addressof … … 527 521 528 522 constexpr T const* operator ->() const { 529 return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), dataptr()); 523 ASSERT_UNDER_CONSTEXPR_CONTEXT(initialized()); 524 return dataptr(); 530 525 } 531 526 … … 536 531 537 532 constexpr T const& operator *() const& { 538 return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), contained_val()); 533 ASSERT_UNDER_CONSTEXPR_CONTEXT(initialized()); 534 return contained_val(); 539 535 } 540 536 … … 670 666 // 20.5.5.3, observers 671 667 constexpr T* operator->() const { 672 return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, ref); 668 ASSERT_UNDER_CONSTEXPR_CONTEXT(ref); 669 return ref; 673 670 } 674 671 675 672 constexpr T& operator*() const { 676 return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, *ref); 673 ASSERT_UNDER_CONSTEXPR_CONTEXT(ref); 674 return *ref; 677 675 } 678 676 … … 1036 1034 1037 1035 # undef TR2_OPTIONAL_REQUIRES 1038 # undef TR2_OPTIONAL_ASSERTED_EXPRESSION1039 1036 1040 1037 #endif // defined(__cpp_lib_optional)
Note: See TracChangeset
for help on using the changeset viewer.