[libcxx-commits] [PATCH] D108384: [libc++][NFCI] Remove unnecessary exception-throwing base classes

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 19 10:59:25 PDT 2021


ldionne updated this revision to Diff 367555.
ldionne marked 2 inline comments as done.
ldionne added a comment.

Address review comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108384/new/

https://reviews.llvm.org/D108384

Files:
  libcxx/include/__split_buffer
  libcxx/include/deque


Index: libcxx/include/deque
===================================================================
--- libcxx/include/deque
+++ libcxx/include/deque
@@ -908,31 +908,8 @@
     return __r;
 }
 
-template <bool>
-class __deque_base_common
-{
-protected:
-    _LIBCPP_NORETURN void __throw_length_error() const;
-    _LIBCPP_NORETURN void __throw_out_of_range() const;
-};
-
-template <bool __b>
-void
-__deque_base_common<__b>::__throw_length_error() const
-{
-    _VSTD::__throw_length_error("deque");
-}
-
-template <bool __b>
-void
-__deque_base_common<__b>::__throw_out_of_range() const
-{
-    _VSTD::__throw_out_of_range("deque");
-}
-
 template <class _Tp, class _Allocator>
 class __deque_base
-    : protected __deque_base_common<true>
 {
     __deque_base(const __deque_base& __c);
     __deque_base& operator=(const __deque_base& __c);
@@ -1873,7 +1850,7 @@
 deque<_Tp, _Allocator>::at(size_type __i)
 {
     if (__i >= __base::size())
-        __base::__throw_out_of_range();
+        _VSTD::__throw_out_of_range("deque");
     size_type __p = __base::__start_ + __i;
     return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
 }
@@ -1884,7 +1861,7 @@
 deque<_Tp, _Allocator>::at(size_type __i) const
 {
     if (__i >= __base::size())
-        __base::__throw_out_of_range();
+        _VSTD::__throw_out_of_range("deque");
     size_type __p = __base::__start_ + __i;
     return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size);
 }
Index: libcxx/include/__split_buffer
===================================================================
--- libcxx/include/__split_buffer
+++ libcxx/include/__split_buffer
@@ -17,17 +17,8 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <bool>
-class __split_buffer_common
-{
-protected:
-    _LIBCPP_NORETURN void __throw_length_error() const;
-    _LIBCPP_NORETURN void __throw_out_of_range() const;
-};
-
 template <class _Tp, class _Allocator = allocator<_Tp> >
 struct __split_buffer
-    : private __split_buffer_common<true>
 {
 private:
     __split_buffer(const __split_buffer&);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108384.367555.patch
Type: text/x-patch
Size: 2106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210819/6c13fc03/attachment.bin>


More information about the libcxx-commits mailing list