[libcxx-commits] [libcxx] [libc++] Put _LIBCPP_NODEBUG on allocator trait aliases. (PR #118835)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 5 11:42:39 PST 2024


================
@@ -232,18 +230,18 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(allocation_result);
 
 template <class _Alloc>
 struct _LIBCPP_TEMPLATE_VIS allocator_traits {
-  using allocator_type                         = _Alloc;
-  using value_type                             = typename allocator_type::value_type;
-  using pointer                                = __pointer<value_type, allocator_type>;
-  using const_pointer                          = typename __const_pointer<value_type, pointer, allocator_type>::type;
-  using void_pointer                           = typename __void_pointer<pointer, allocator_type>::type;
-  using const_void_pointer                     = typename __const_void_pointer<pointer, allocator_type>::type;
-  using difference_type                        = typename __alloc_traits_difference_type<allocator_type, pointer>::type;
-  using size_type                              = __size_type<allocator_type, difference_type>;
-  using propagate_on_container_copy_assignment = __propagate_on_container_copy_assignment<allocator_type>;
-  using propagate_on_container_move_assignment = __propagate_on_container_move_assignment<allocator_type>;
-  using propagate_on_container_swap            = __propagate_on_container_swap<allocator_type>;
-  using is_always_equal                        = __is_always_equal<allocator_type>;
+  using allocator_type _LIBCPP_NODEBUG                         = _Alloc;
+  using value_type _LIBCPP_NODEBUG                             = typename allocator_type::value_type;
+  using pointer _LIBCPP_NODEBUG                                = __pointer<value_type, allocator_type>;
+  using const_pointer _LIBCPP_NODEBUG                          = typename __const_pointer<value_type, pointer, allocator_type>::type;
+  using void_pointer _LIBCPP_NODEBUG                           = typename __void_pointer<pointer, allocator_type>::type;
+  using const_void_pointer _LIBCPP_NODEBUG                     = typename __const_void_pointer<pointer, allocator_type>::type;
+  using difference_type _LIBCPP_NODEBUG                        = typename __alloc_traits_difference_type<allocator_type, pointer>::type;
+  using size_type _LIBCPP_NODEBUG                              = __size_type<allocator_type, difference_type>;
+  using propagate_on_container_copy_assignment _LIBCPP_NODEBUG = __propagate_on_container_copy_assignment<allocator_type>;
+  using propagate_on_container_move_assignment _LIBCPP_NODEBUG = __propagate_on_container_move_assignment<allocator_type>;
+  using propagate_on_container_swap _LIBCPP_NODEBUG            = __propagate_on_container_swap<allocator_type>;
+  using is_always_equal _LIBCPP_NODEBUG                        = __is_always_equal<allocator_type>;
----------------
cmtice wrote:

Summary of complete findings, with respect to changes in .gdb_index size, on my test program.

Before https://github.com/llvm/llvm-project/pull/115654,  .gdb-index is  230.8 MB   (baseline)
After https://github.com/llvm/llvm-project/pull/115654:      .gdb_index is 252.4 MB   (9.4% increase)
With this complete PR:                                                      .gdb_index is 229.2 MB   (0.7% decrease!)
This PR, removing _LIBCPP_NODEBUG on lines above: .gdb_index is 229.2 MB (slight size increase of ~15KB)
Also removing it in two places questioned below:              No change to previous size.

So, in summary: Having the annotation on the lines above makes .gdb_index (for my one test case) ~ 15 KB smaller. Having the annotation on line 258 in allocator_traits.h and on line 413 in unique_ptr.h does not appear to affect the size of .gdb_index (for my one test case).

Please let me know for sure what you would like me to do.

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


More information about the libcxx-commits mailing list