Skip to content

Revert "[libc++][vector] Inline remaining constructors filling vector with the same value" #93020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

vitalybuka
Copy link
Collaborator

@vitalybuka vitalybuka requested a review from a team as a code owner May 22, 2024 11:28
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label May 22, 2024
@llvmbot
Copy link
Member

llvmbot commented May 22, 2024

@llvm/pr-subscribers-libcxx

Author: Vitaly Buka (vitalybuka)

Changes

https://lab.llvm.org/buildbot/#/builders/168/builds/20464

Reverts llvm/llvm-project#82068


Full diff: https://github.com/llvm/llvm-project/pull/93020.diff

1 Files Affected:

  • (modified) libcxx/include/vector (+36-28)
diff --git a/libcxx/include/vector b/libcxx/include/vector
index b190557fb7b7e..976bde9b9048c 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -424,36 +424,11 @@ public:
 #endif
       : __end_cap_(nullptr, __a) {
   }
-
-  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n) {
-    auto __guard = std::__make_exception_guard(__destroy_vector(*this));
-    if (__n > 0) {
-      __vallocate(__n);
-      __construct_at_end(__n);
-    }
-    __guard.__complete();
-  }
-
+  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n);
 #if _LIBCPP_STD_VER >= 14
-  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a)
-      : __end_cap_(nullptr, __a) {
-    auto __guard = std::__make_exception_guard(__destroy_vector(*this));
-    if (__n > 0) {
-      __vallocate(__n);
-      __construct_at_end(__n);
-    }
-    __guard.__complete();
-  }
+  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a);
 #endif
-
-  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x) {
-    auto __guard = std::__make_exception_guard(__destroy_vector(*this));
-    if (__n > 0) {
-      __vallocate(__n);
-      __construct_at_end(__n, __x);
-    }
-    __guard.__complete();
-  }
+  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x);
 
   template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0>
   _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
@@ -1150,6 +1125,39 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__append(size_type _
   }
 }
 
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n) {
+  auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+  if (__n > 0) {
+    __vallocate(__n);
+    __construct_at_end(__n);
+  }
+  __guard.__complete();
+}
+
+#if _LIBCPP_STD_VER >= 14
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
+    : __end_cap_(nullptr, __a) {
+  auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+  if (__n > 0) {
+    __vallocate(__n);
+    __construct_at_end(__n);
+  }
+  __guard.__complete();
+}
+#endif
+
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x) {
+  auto __guard = std::__make_exception_guard(__destroy_vector(*this));
+  if (__n > 0) {
+    __vallocate(__n);
+    __construct_at_end(__n, __x);
+  }
+  __guard.__complete();
+}
+
 template <class _Tp, class _Allocator>
 template <class _InputIterator,
           __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value &&

@vitalybuka vitalybuka requested a review from philnik777 May 22, 2024 11:30
@philnik777
Copy link
Contributor

Why do you think that this is in any way related? The CI passed on the patch and this is just moving code around.

@vitalybuka
Copy link
Collaborator Author

Why do you think that this is in any way related? The CI passed on the patch and this is just moving code around.

It's not. Another breakage overlapped with this one. Real cause is https://lab.llvm.org/buildbot/#/builders/168/builds/20461

@vitalybuka vitalybuka closed this May 22, 2024
@ldionne ldionne deleted the revert-82068-main branch May 27, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants