[libcxx-commits] [libcxx] [libc++][NFC] Use __construct_at and __destroy_at insted of using preprocessor conditionals (PR #70866)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 23 13:16:46 PST 2023
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 59e24eea3438ab2925bda025f52d2cce92195065 a45da7e8816ffb39be210734e57ba18a0c2bde5a -- libcxx/include/__memory/allocator_traits.h libcxx/include/optional libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.verify.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__memory/allocator_traits.h b/libcxx/include/__memory/allocator_traits.h
index eea5ee973d..a2ce48b3fb 100644
--- a/libcxx/include/__memory/allocator_traits.h
+++ b/libcxx/include/__memory/allocator_traits.h
@@ -300,7 +300,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
__enable_if_t<!__has_construct<allocator_type, _Tp*, _Args...>::value> >
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
static void construct(allocator_type&, _Tp* __p, _Args&&... __args) {
- std::__construct_at(__p, std::forward<_Args>(__args)...);
+ std::__construct_at(__p, std::forward<_Args>(__args)...);
}
template <class _Tp, class =
@@ -315,7 +315,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
__enable_if_t<!__has_destroy<allocator_type, _Tp*>::value> >
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
static void destroy(allocator_type&, _Tp* __p) {
- std::__destroy_at(__p);
+ std::__destroy_at(__p);
}
template <class _Ap = _Alloc, class =
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp
index 6097102dd5..a333c9ccaa 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/copy.move_only.verify.cpp
@@ -16,5 +16,6 @@
void f() {
std::vector<MoveOnly> v;
- std::vector<MoveOnly> copy = v; // expected-error-re@* {{{{(no matching function for call to '__construct_at')|(call to implicitly-deleted copy constructor of 'MoveOnly')}}}}
+ std::vector<MoveOnly> copy =
+ v; // expected-error-re@* {{{{(no matching function for call to '__construct_at')|(call to implicitly-deleted copy constructor of 'MoveOnly')}}}}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/70866
More information about the libcxx-commits
mailing list