[libcxx-commits] [libcxx] [libc++] Add tombstone traits and use them in optional (PR #98498)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 7 07:26:15 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff f43ef53dd20b83ea0db6fdba69025c9a76a1de08 522dfe89aa843a4db041f2cc7e577ff64adb8461 --extensions cpp,,h -- libcxx/include/__memory/tombstone_traits.h libcxx/test/std/utilities/optional/tombstone_types.pass.cpp libcxx/include/__expected/expected.h libcxx/include/__functional/reference_wrapper.h libcxx/include/__locale libcxx/include/__memory/shared_ptr.h libcxx/include/__memory/unique_ptr.h libcxx/include/__type_traits/enable_if.h libcxx/include/__utility/pair.h libcxx/include/__vector/vector.h libcxx/include/optional libcxx/include/string libcxx/include/string_view libcxx/test/libcxx/utilities/optional/optional.object/optional_size.pass.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index 2094f28abc..79693eb8c5 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -450,9 +450,8 @@ pair(_T1, _T2) -> pair<_T1, _T2>;
 template <class _Tp, class _Up>
   requires __has_tombstone_v<_Up>
 struct __tombstone_traits<pair<_Tp, _Up>> {
-  static constexpr auto __disengaged_value_ = __tombstone_traits<_Up>::__disengaged_value_;
-  static constexpr size_t __is_disengaged_offset_ =
-      sizeof(_Tp) + __tombstone_traits<_Up>::__is_disengaged_offset_;
+  static constexpr auto __disengaged_value_       = __tombstone_traits<_Up>::__disengaged_value_;
+  static constexpr size_t __is_disengaged_offset_ = sizeof(_Tp) + __tombstone_traits<_Up>::__is_disengaged_offset_;
 };
 
 template <class _Tp, class _Up>

``````````

</details>


https://github.com/llvm/llvm-project/pull/98498


More information about the libcxx-commits mailing list