Skip to content

[libc++] Put _LIBCPP_NODEBUG on all internal aliases #118710

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

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

philnik777
Copy link
Contributor

@philnik777 philnik777 commented Dec 4, 2024

This significantly reduces the amount of debug information generated
for codebases using libc++, without hurting the debugging experience.

Copy link

github-actions bot commented Dec 4, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@philnik777
Copy link
Contributor Author

@dwblaikie @cmtice Would you be able to give numbers on how much this patch changes things?

@philnik777 philnik777 force-pushed the nodebug_on_internal_aliases branch from 17617b8 to 8f5a80d Compare December 4, 2024 23:31
@cmtice
Copy link
Contributor

cmtice commented Dec 5, 2024

This patch significantly improves things. WIth it, instead of my gdb_index getting 9.5% larger, it gets 4.2% smaller.

One question: Is there a reason for preferring [[gnu::nodebug]] over _LIBCPP_NODEBUG? The reason I ask: we've been moving away from using gdb_index in favor of using the debug_names index instead, and I worry about whether the code that builds the debug_names index would honor [[gnu::nodebug]]...

@cmtice
Copy link
Contributor

cmtice commented Dec 5, 2024

Also, since you're doing this, I'm guessing there's no point in my trying to put together a PR?

@cmtice
Copy link
Contributor

cmtice commented Dec 5, 2024

I've created a PR for fixing the original issue, using _LIBCPP_NODEBUG: #118835

@dwblaikie
Copy link
Collaborator

This patch significantly improves things. WIth it, instead of my gdb_index getting 9.5% larger, it gets 4.2% smaller.

One question: Is there a reason for preferring [[gnu::nodebug]] over _LIBCPP_NODEBUG?

I'd be curious about this too - just to know if there's a change in policy, or minimum compiler version, etc. (perhaps we should stick with _LIBCPP_NODEBUG for now, to be consistent with existing practice, and have a separate RFC/discussion about changing that direction uniformly/as a mass refactoring?)

The reason I ask: we've been moving away from using gdb_index in favor of using the debug_names index instead, and I worry about whether the code that builds the debug_names index would honor [[gnu::nodebug]]...

This isn't an issue. These are different spellings of the same behavior for clang, you can verify this with a small example on Compiler Explorer, like this: https://godbolt.org/z/o3jT967hE (you can see in the llvm-dwarfdump output that both t1 and t2 are omitted, but t3 is not)

@dwblaikie
Copy link
Collaborator

I'd also encourage applying this to all the non-internal type aliases in type traits. We added a lot of these to upstream libcxx after looking at the DWARF size cost when Google was migrating to libcxx, but it doesn't seem to have been applied entirely consistently. 82 using type have NODEBUG out of a total of 435 instances of using type.

@philnik777 philnik777 marked this pull request as ready for review December 9, 2024 15:55
@philnik777 philnik777 requested a review from a team as a code owner December 9, 2024 15:55
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Dec 9, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 9, 2024

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

Patch is 200.99 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/118710.diff

155 Files Affected:

  • (modified) libcxx/include/__algorithm/comp_ref_type.h (+2-2)
  • (modified) libcxx/include/__algorithm/copy.h (+1-1)
  • (modified) libcxx/include/__algorithm/iterator_operations.h (+9-9)
  • (modified) libcxx/include/__algorithm/move.h (+1-1)
  • (modified) libcxx/include/__algorithm/ranges_iterator_concept.h (+1-1)
  • (modified) libcxx/include/__algorithm/ranges_unique_copy.h (+1-1)
  • (modified) libcxx/include/__algorithm/simd_utils.h (+4-3)
  • (modified) libcxx/include/__algorithm/sort.h (+2-2)
  • (modified) libcxx/include/__algorithm/three_way_comp_ref_type.h (+2-2)
  • (modified) libcxx/include/__algorithm/unwrap_iter.h (+1-1)
  • (modified) libcxx/include/__atomic/aliases.h (+5-5)
  • (modified) libcxx/include/__atomic/atomic.h (+10-10)
  • (modified) libcxx/include/__atomic/atomic_ref.h (+5-5)
  • (modified) libcxx/include/__atomic/atomic_sync.h (+1-1)
  • (modified) libcxx/include/__atomic/contention_t.h (+3-3)
  • (modified) libcxx/include/__atomic/memory_order.h (+1-1)
  • (modified) libcxx/include/__bit_reference (+12-12)
  • (modified) libcxx/include/__chrono/formatter.h (+23-23)
  • (modified) libcxx/include/__chrono/hh_mm_ss.h (+1-1)
  • (modified) libcxx/include/__chrono/parser_std_format_spec.h (+1-1)
  • (modified) libcxx/include/__compare/ordering.h (+2-2)
  • (modified) libcxx/include/__compare/synth_three_way.h (+2-1)
  • (modified) libcxx/include/__exception/exception_ptr.h (+1-1)
  • (modified) libcxx/include/__expected/expected.h (+5-5)
  • (modified) libcxx/include/__expected/unexpected.h (+6-6)
  • (modified) libcxx/include/__filesystem/path.h (+17-17)
  • (modified) libcxx/include/__flat_map/flat_map.h (+4-3)
  • (modified) libcxx/include/__format/buffer.h (+9-8)
  • (modified) libcxx/include/__format/concepts.h (+1-1)
  • (modified) libcxx/include/__format/container_adaptor.h (+2-2)
  • (modified) libcxx/include/__format/format_arg.h (+1-1)
  • (modified) libcxx/include/__format/format_arg_store.h (+1-1)
  • (modified) libcxx/include/__format/format_functions.h (+1-1)
  • (modified) libcxx/include/__format/formatter_floating_point.h (+1-1)
  • (modified) libcxx/include/__format/formatter_string.h (+5-5)
  • (modified) libcxx/include/__format/range_default_formatter.h (+7-6)
  • (modified) libcxx/include/__format/unicode.h (+5-5)
  • (modified) libcxx/include/__functional/binary_function.h (+2-2)
  • (modified) libcxx/include/__functional/bind.h (+1-1)
  • (modified) libcxx/include/__functional/boyer_moore_searcher.h (+2-2)
  • (modified) libcxx/include/__functional/function.h (+2-2)
  • (modified) libcxx/include/__functional/perfect_forward.h (+1-1)
  • (modified) libcxx/include/__functional/unary_function.h (+1-1)
  • (modified) libcxx/include/__hash_table (+2-2)
  • (modified) libcxx/include/__iterator/aliasing_iterator.h (+3-3)
  • (modified) libcxx/include/__iterator/concepts.h (+4-4)
  • (modified) libcxx/include/__iterator/insert_iterator.h (+2-2)
  • (modified) libcxx/include/__iterator/iterator_traits.h (+29-23)
  • (modified) libcxx/include/__iterator/projected.h (+6-6)
  • (modified) libcxx/include/__iterator/ranges_iterator_traits.h (+3-3)
  • (modified) libcxx/include/__iterator/reverse_iterator.h (+2-2)
  • (modified) libcxx/include/__iterator/segmented_iterator.h (+1-1)
  • (modified) libcxx/include/__locale (+1-1)
  • (modified) libcxx/include/__locale_dir/locale_base_api.h (+1-1)
  • (modified) libcxx/include/__mdspan/extents.h (+7-6)
  • (modified) libcxx/include/__memory/allocation_guard.h (+2-2)
  • (modified) libcxx/include/__memory/allocator_traits.h (+19-14)
  • (modified) libcxx/include/__memory/pointer_traits.h (+4-4)
  • (modified) libcxx/include/__memory/shared_ptr.h (+5-4)
  • (modified) libcxx/include/__memory/unique_ptr.h (+5-5)
  • (modified) libcxx/include/__memory/unique_temporary_buffer.h (+1-1)
  • (modified) libcxx/include/__node_handle (+2-2)
  • (modified) libcxx/include/__pstl/backend_fwd.h (+6-3)
  • (modified) libcxx/include/__pstl/dispatch.h (+2-1)
  • (modified) libcxx/include/__ranges/chunk_by_view.h (+1-1)
  • (modified) libcxx/include/__ranges/drop_view.h (+3-3)
  • (modified) libcxx/include/__ranges/drop_while_view.h (+2-2)
  • (modified) libcxx/include/__ranges/elements_view.h (+2-2)
  • (modified) libcxx/include/__ranges/filter_view.h (+3-3)
  • (modified) libcxx/include/__ranges/iota_view.h (+1-1)
  • (modified) libcxx/include/__ranges/join_view.h (+20-17)
  • (modified) libcxx/include/__ranges/lazy_split_view.h (+6-5)
  • (modified) libcxx/include/__ranges/repeat_view.h (+3-2)
  • (modified) libcxx/include/__ranges/reverse_view.h (+2-1)
  • (modified) libcxx/include/__ranges/split_view.h (+1-1)
  • (modified) libcxx/include/__ranges/subrange.h (+1-1)
  • (modified) libcxx/include/__ranges/take_view.h (+3-3)
  • (modified) libcxx/include/__ranges/take_while_view.h (+1-1)
  • (modified) libcxx/include/__ranges/transform_view.h (+5-5)
  • (modified) libcxx/include/__split_buffer (+13-13)
  • (modified) libcxx/include/__stop_token/stop_state.h (+4-4)
  • (modified) libcxx/include/__thread/support/pthread.h (+1-1)
  • (modified) libcxx/include/__tuple/make_tuple_types.h (+6-5)
  • (modified) libcxx/include/__tuple/sfinae_helpers.h (+1-1)
  • (modified) libcxx/include/__tuple/tuple_size.h (+1-1)
  • (modified) libcxx/include/__type_traits/add_lvalue_reference.h (+1-1)
  • (modified) libcxx/include/__type_traits/add_pointer.h (+1-1)
  • (modified) libcxx/include/__type_traits/add_rvalue_reference.h (+1-1)
  • (modified) libcxx/include/__type_traits/common_reference.h (+10-10)
  • (modified) libcxx/include/__type_traits/common_type.h (+1-1)
  • (modified) libcxx/include/__type_traits/conjunction.h (+1-1)
  • (modified) libcxx/include/__type_traits/copy_cv.h (+5-5)
  • (modified) libcxx/include/__type_traits/copy_cvref.h (+1-1)
  • (modified) libcxx/include/__type_traits/detected_or.h (+1-1)
  • (modified) libcxx/include/__type_traits/disjunction.h (+1-1)
  • (modified) libcxx/include/__type_traits/invoke.h (+11-10)
  • (modified) libcxx/include/__type_traits/is_always_bitcastable.h (+2-2)
  • (modified) libcxx/include/__type_traits/is_char_like_type.h (+1-1)
  • (modified) libcxx/include/__type_traits/is_equality_comparable.h (+1-1)
  • (modified) libcxx/include/__type_traits/is_execution_policy.h (+1-1)
  • (modified) libcxx/include/__type_traits/is_primary_template.h (+3-2)
  • (modified) libcxx/include/__type_traits/is_same.h (+2-2)
  • (modified) libcxx/include/__type_traits/is_swappable.h (+3-2)
  • (modified) libcxx/include/__type_traits/make_32_64_or_128_bit.h (+1-1)
  • (modified) libcxx/include/__type_traits/make_const_lvalue_ref.h (+1-1)
  • (modified) libcxx/include/__type_traits/make_signed.h (+1-1)
  • (modified) libcxx/include/__type_traits/make_unsigned.h (+3-2)
  • (modified) libcxx/include/__type_traits/maybe_const.h (+1-1)
  • (modified) libcxx/include/__type_traits/remove_all_extents.h (+1-1)
  • (modified) libcxx/include/__type_traits/remove_const.h (+1-1)
  • (modified) libcxx/include/__type_traits/remove_const_ref.h (+1-1)
  • (modified) libcxx/include/__type_traits/remove_cv.h (+2-2)
  • (modified) libcxx/include/__type_traits/remove_cvref.h (+1-1)
  • (modified) libcxx/include/__type_traits/remove_extent.h (+1-1)
  • (modified) libcxx/include/__type_traits/remove_pointer.h (+2-2)
  • (modified) libcxx/include/__type_traits/remove_reference.h (+1-1)
  • (modified) libcxx/include/__type_traits/remove_volatile.h (+1-1)
  • (modified) libcxx/include/__type_traits/void_t.h (+1-1)
  • (modified) libcxx/include/__utility/exception_guard.h (+2-2)
  • (modified) libcxx/include/__utility/forward_like.h (+6-5)
  • (modified) libcxx/include/__utility/in_place.h (+2-2)
  • (modified) libcxx/include/__utility/integer_sequence.h (+4-4)
  • (modified) libcxx/include/__utility/move.h (+1-1)
  • (modified) libcxx/include/__utility/pair.h (+1-1)
  • (modified) libcxx/include/__utility/swap.h (+3-2)
  • (modified) libcxx/include/__vector/vector.h (+1-1)
  • (modified) libcxx/include/any (+7-5)
  • (modified) libcxx/include/array (+15-14)
  • (modified) libcxx/include/barrier (+1-1)
  • (modified) libcxx/include/ccomplex (+5-4)
  • (modified) libcxx/include/ciso646 (+3-2)
  • (modified) libcxx/include/complex (+1-1)
  • (modified) libcxx/include/cstdalign (+4-4)
  • (modified) libcxx/include/cstdbool (+4-4)
  • (modified) libcxx/include/ctgmath (+6-4)
  • (modified) libcxx/include/deque (+16-14)
  • (modified) libcxx/include/experimental/__simd/scalar.h (+3-3)
  • (modified) libcxx/include/experimental/__simd/simd.h (+2-2)
  • (modified) libcxx/include/experimental/__simd/simd_mask.h (+2-2)
  • (modified) libcxx/include/experimental/__simd/vec_ext.h (+3-3)
  • (modified) libcxx/include/forward_list (+2-1)
  • (modified) libcxx/include/ios (+2-2)
  • (modified) libcxx/include/optional (+14-13)
  • (modified) libcxx/include/ratio (+1-1)
  • (modified) libcxx/include/regex (+2-1)
  • (modified) libcxx/include/source_location (+1-1)
  • (modified) libcxx/include/string (+3-3)
  • (modified) libcxx/include/tuple (+2-1)
  • (modified) libcxx/include/variant (+17-17)
  • (modified) libcxx/test/tools/clang_tidy_checks/CMakeLists.txt (+1)
  • (modified) libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp (+2)
  • (added) libcxx/test/tools/clang_tidy_checks/nodebug_on_internal_aliases.cpp (+35)
  • (added) libcxx/test/tools/clang_tidy_checks/nodebug_on_internal_aliases.hpp (+18)
  • (modified) libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp (+5-16)
  • (added) libcxx/test/tools/clang_tidy_checks/utilities.hpp (+23)
diff --git a/libcxx/include/__algorithm/comp_ref_type.h b/libcxx/include/__algorithm/comp_ref_type.h
index c367fbb91ac282..d98aef40a79ddb 100644
--- a/libcxx/include/__algorithm/comp_ref_type.h
+++ b/libcxx/include/__algorithm/comp_ref_type.h
@@ -56,10 +56,10 @@ struct __debug_less {
 // Pass the comparator by lvalue reference. Or in the debug mode, using a debugging wrapper that stores a reference.
 #if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
 template <class _Comp>
-using __comp_ref_type = __debug_less<_Comp>;
+using __comp_ref_type [[__gnu__::__nodebug__]] = __debug_less<_Comp>;
 #else
 template <class _Comp>
-using __comp_ref_type = _Comp&;
+using __comp_ref_type [[__gnu__::__nodebug__]] = _Comp&;
 #endif
 
 _LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__algorithm/copy.h b/libcxx/include/__algorithm/copy.h
index 4f30b2050abbaf..210ae3086ab7a5 100644
--- a/libcxx/include/__algorithm/copy.h
+++ b/libcxx/include/__algorithm/copy.h
@@ -47,7 +47,7 @@ struct __copy_impl {
 
   template <class _InIter, class _OutIter>
   struct _CopySegment {
-    using _Traits = __segmented_iterator_traits<_InIter>;
+    using _Traits [[__gnu__::__nodebug__]] = __segmented_iterator_traits<_InIter>;
 
     _OutIter& __result_;
 
diff --git a/libcxx/include/__algorithm/iterator_operations.h b/libcxx/include/__algorithm/iterator_operations.h
index 6cdb0aec9b2db8..4ba9072ddf63bd 100644
--- a/libcxx/include/__algorithm/iterator_operations.h
+++ b/libcxx/include/__algorithm/iterator_operations.h
@@ -48,13 +48,13 @@ struct _RangeAlgPolicy {};
 template <>
 struct _IterOps<_RangeAlgPolicy> {
   template <class _Iter>
-  using __value_type = iter_value_t<_Iter>;
+  using __value_type [[__gnu__::__nodebug__]] = iter_value_t<_Iter>;
 
   template <class _Iter>
-  using __iterator_category = ranges::__iterator_concept<_Iter>;
+  using __iterator_category [[__gnu__::__nodebug__]] = ranges::__iterator_concept<_Iter>;
 
   template <class _Iter>
-  using __difference_type = iter_difference_t<_Iter>;
+  using __difference_type [[__gnu__::__nodebug__]] = iter_difference_t<_Iter>;
 
   static constexpr auto advance      = ranges::advance;
   static constexpr auto distance     = ranges::distance;
@@ -72,13 +72,13 @@ struct _ClassicAlgPolicy {};
 template <>
 struct _IterOps<_ClassicAlgPolicy> {
   template <class _Iter>
-  using __value_type = typename iterator_traits<_Iter>::value_type;
+  using __value_type [[__gnu__::__nodebug__]] = typename iterator_traits<_Iter>::value_type;
 
   template <class _Iter>
-  using __iterator_category = typename iterator_traits<_Iter>::iterator_category;
+  using __iterator_category [[__gnu__::__nodebug__]] = typename iterator_traits<_Iter>::iterator_category;
 
   template <class _Iter>
-  using __difference_type = typename iterator_traits<_Iter>::difference_type;
+  using __difference_type [[__gnu__::__nodebug__]] = typename iterator_traits<_Iter>::difference_type;
 
   // advance
   template <class _Iter, class _Distance>
@@ -94,10 +94,10 @@ struct _IterOps<_ClassicAlgPolicy> {
   }
 
   template <class _Iter>
-  using __deref_t = decltype(*std::declval<_Iter&>());
+  using __deref_t [[__gnu__::__nodebug__]] = decltype(*std::declval<_Iter&>());
 
   template <class _Iter>
-  using __move_t = decltype(std::move(*std::declval<_Iter&>()));
+  using __move_t [[__gnu__::__nodebug__]] = decltype(std::move(*std::declval<_Iter&>()));
 
   template <class _Iter>
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static void __validate_iter_reference() {
@@ -217,7 +217,7 @@ struct _IterOps<_ClassicAlgPolicy> {
 };
 
 template <class _AlgPolicy, class _Iter>
-using __policy_iter_diff_t = typename _IterOps<_AlgPolicy>::template __difference_type<_Iter>;
+using __policy_iter_diff_t [[__gnu__::__nodebug__]] = typename _IterOps<_AlgPolicy>::template __difference_type<_Iter>;
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__algorithm/move.h b/libcxx/include/__algorithm/move.h
index 005099dcac06e3..48c3b9061f06f2 100644
--- a/libcxx/include/__algorithm/move.h
+++ b/libcxx/include/__algorithm/move.h
@@ -50,7 +50,7 @@ struct __move_impl {
 
   template <class _InIter, class _OutIter>
   struct _MoveSegment {
-    using _Traits = __segmented_iterator_traits<_InIter>;
+    using _Traits [[__gnu__::__nodebug__]] = __segmented_iterator_traits<_InIter>;
 
     _OutIter& __result_;
 
diff --git a/libcxx/include/__algorithm/ranges_iterator_concept.h b/libcxx/include/__algorithm/ranges_iterator_concept.h
index 2af891d3af005a..4846ef4139d0f5 100644
--- a/libcxx/include/__algorithm/ranges_iterator_concept.h
+++ b/libcxx/include/__algorithm/ranges_iterator_concept.h
@@ -44,7 +44,7 @@ consteval auto __get_iterator_concept() {
 }
 
 template <class _Iter>
-using __iterator_concept = decltype(__get_iterator_concept<_Iter>());
+using __iterator_concept [[__gnu__::__nodebug__]] = decltype(__get_iterator_concept<_Iter>());
 
 } // namespace ranges
 _LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__algorithm/ranges_unique_copy.h b/libcxx/include/__algorithm/ranges_unique_copy.h
index 3b4a64e94ca1f5..2b0e7358f47a51 100644
--- a/libcxx/include/__algorithm/ranges_unique_copy.h
+++ b/libcxx/include/__algorithm/ranges_unique_copy.h
@@ -60,7 +60,7 @@ struct __unique_copy {
   }
 
   template <class _InIter, class _OutIter>
-  using __algo_tag_t = decltype(__get_algo_tag<_InIter, _OutIter>());
+  using __algo_tag_t [[__gnu__::__nodebug__]] = decltype(__get_algo_tag<_InIter, _OutIter>());
 
   template <input_iterator _InIter,
             sentinel_for<_InIter> _Sent,
diff --git a/libcxx/include/__algorithm/simd_utils.h b/libcxx/include/__algorithm/simd_utils.h
index 4e3e4f2b9404e3..ab359bb8c8fa97 100644
--- a/libcxx/include/__algorithm/simd_utils.h
+++ b/libcxx/include/__algorithm/simd_utils.h
@@ -70,7 +70,7 @@ struct __get_as_integer_type_impl<8> {
 };
 
 template <class _Tp>
-using __get_as_integer_type_t = typename __get_as_integer_type_impl<sizeof(_Tp)>::type;
+using __get_as_integer_type_t [[__gnu__::__nodebug__]] = typename __get_as_integer_type_impl<sizeof(_Tp)>::type;
 
 // This isn't specialized for 64 byte vectors on purpose. They have the potential to significantly reduce performance
 // in mixed simd/non-simd workloads and don't provide any performance improvement for currently vectorized algorithms
@@ -90,7 +90,7 @@ inline constexpr size_t __native_vector_size = 1;
 #  endif
 
 template <class _ArithmeticT, size_t _Np>
-using __simd_vector __attribute__((__ext_vector_type__(_Np))) = _ArithmeticT;
+using __simd_vector __attribute__((__ext_vector_type__(_Np))) [[__gnu__::__nodebug__]] = _ArithmeticT;
 
 template <class _VecT>
 inline constexpr size_t __simd_vector_size_v = []<bool _False = false>() -> size_t {
@@ -106,7 +106,8 @@ _LIBCPP_HIDE_FROM_ABI _Tp __simd_vector_underlying_type_impl(__simd_vector<_Tp,
 }
 
 template <class _VecT>
-using __simd_vector_underlying_type_t = decltype(std::__simd_vector_underlying_type_impl(_VecT{}));
+using __simd_vector_underlying_type_t [[__gnu__::__nodebug__]] =
+    decltype(std::__simd_vector_underlying_type_impl(_VecT{}));
 
 // This isn't inlined without always_inline when loading chars.
 template <class _VecT, class _Iter>
diff --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h
index ed828b6d723147..9a5f64f9e69f69 100644
--- a/libcxx/include/__algorithm/sort.h
+++ b/libcxx/include/__algorithm/sort.h
@@ -890,10 +890,10 @@ __sort_dispatch(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
 }
 
 template <class _Type, class... _Options>
-using __is_any_of = _Or<is_same<_Type, _Options>...>;
+using __is_any_of [[__gnu__::__nodebug__]] = _Or<is_same<_Type, _Options>...>;
 
 template <class _Type>
-using __sort_is_specialized_in_library = __is_any_of<
+using __sort_is_specialized_in_library [[__gnu__::__nodebug__]] = __is_any_of<
     _Type,
     char,
 #if _LIBCPP_HAS_WIDE_CHARACTERS
diff --git a/libcxx/include/__algorithm/three_way_comp_ref_type.h b/libcxx/include/__algorithm/three_way_comp_ref_type.h
index 5702a1fee08262..a76392988503d6 100644
--- a/libcxx/include/__algorithm/three_way_comp_ref_type.h
+++ b/libcxx/include/__algorithm/three_way_comp_ref_type.h
@@ -61,10 +61,10 @@ struct __debug_three_way_comp {
 // Pass the comparator by lvalue reference. Or in the debug mode, using a debugging wrapper that stores a reference.
 #  if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
 template <class _Comp>
-using __three_way_comp_ref_type = __debug_three_way_comp<_Comp>;
+using __three_way_comp_ref_type [[__gnu__::__nodebug__]] = __debug_three_way_comp<_Comp>;
 #  else
 template <class _Comp>
-using __three_way_comp_ref_type = _Comp&;
+using __three_way_comp_ref_type [[__gnu__::__nodebug__]] = _Comp&;
 #  endif
 
 #endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__algorithm/unwrap_iter.h b/libcxx/include/__algorithm/unwrap_iter.h
index 8cc0d22d4fc211..57b5a22240bb71 100644
--- a/libcxx/include/__algorithm/unwrap_iter.h
+++ b/libcxx/include/__algorithm/unwrap_iter.h
@@ -46,7 +46,7 @@ struct __unwrap_iter_impl {
 // It's a contiguous iterator, so we can use a raw pointer instead
 template <class _Iter>
 struct __unwrap_iter_impl<_Iter, true> {
-  using _ToAddressT = decltype(std::__to_address(std::declval<_Iter>()));
+  using _ToAddressT [[__gnu__::__nodebug__]] = decltype(std::__to_address(std::declval<_Iter>()));
 
   static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __rewrap(_Iter __orig_iter, _ToAddressT __unwrapped_iter) {
     return __orig_iter + (__unwrapped_iter - std::__to_address(__orig_iter));
diff --git a/libcxx/include/__atomic/aliases.h b/libcxx/include/__atomic/aliases.h
index 37d11dd0aabf36..a95de035cc33ee 100644
--- a/libcxx/include/__atomic/aliases.h
+++ b/libcxx/include/__atomic/aliases.h
@@ -84,19 +84,19 @@ using atomic_uintmax_t = atomic<uintmax_t>;
 // C++20 atomic_{signed,unsigned}_lock_free: prefer the contention type most highly, then the largest lock-free type
 #if _LIBCPP_STD_VER >= 20
 #  if ATOMIC_LLONG_LOCK_FREE == 2
-using __largest_lock_free_type = long long;
+using __largest_lock_free_type [[__gnu__::__nodebug__]] = long long;
 #  elif ATOMIC_INT_LOCK_FREE == 2
-using __largest_lock_free_type = int;
+using __largest_lock_free_type [[__gnu__::__nodebug__]] = int;
 #  elif ATOMIC_SHORT_LOCK_FREE == 2
-using __largest_lock_free_type = short;
+using __largest_lock_free_type [[__gnu__::__nodebug__]] = short;
 #  elif ATOMIC_CHAR_LOCK_FREE == 2
-using __largest_lock_free_type = char;
+using __largest_lock_free_type [[__gnu__::__nodebug__]] = char;
 #  else
 #    define _LIBCPP_NO_LOCK_FREE_TYPES // There are no lockfree types (this can happen on unusual platforms)
 #  endif
 
 #  ifndef _LIBCPP_NO_LOCK_FREE_TYPES
-using __contention_t_or_largest =
+using __contention_t_or_largest [[__gnu__::__nodebug__]] =
     __conditional_t<__libcpp_is_always_lock_free<__cxx_contention_t>::__value,
                     __cxx_contention_t,
                     __largest_lock_free_type>;
diff --git a/libcxx/include/__atomic/atomic.h b/libcxx/include/__atomic/atomic.h
index d83719c8733d7e..79dc2277bf7a2e 100644
--- a/libcxx/include/__atomic/atomic.h
+++ b/libcxx/include/__atomic/atomic.h
@@ -143,7 +143,7 @@ struct __atomic_base // false
 
 template <class _Tp>
 struct __atomic_base<_Tp, true> : public __atomic_base<_Tp, false> {
-  using __base = __atomic_base<_Tp, false>;
+  using __base [[__gnu__::__nodebug__]] = __atomic_base<_Tp, false>;
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __atomic_base() _NOEXCEPT = default;
 
@@ -228,9 +228,9 @@ struct __atomic_waitable_traits<__atomic_base<_Tp, _IsIntegral> > {
 
 template <class _Tp>
 struct atomic : public __atomic_base<_Tp> {
-  using __base          = __atomic_base<_Tp>;
-  using value_type      = _Tp;
-  using difference_type = value_type;
+  using __base [[__gnu__::__nodebug__]] = __atomic_base<_Tp>;
+  using value_type                      = _Tp;
+  using difference_type                 = value_type;
 
 #if _LIBCPP_STD_VER >= 20
   _LIBCPP_HIDE_FROM_ABI atomic() = default;
@@ -257,9 +257,9 @@ struct atomic : public __atomic_base<_Tp> {
 
 template <class _Tp>
 struct atomic<_Tp*> : public __atomic_base<_Tp*> {
-  using __base          = __atomic_base<_Tp*>;
-  using value_type      = _Tp*;
-  using difference_type = ptrdiff_t;
+  using __base [[__gnu__::__nodebug__]] = __atomic_base<_Tp*>;
+  using value_type                      = _Tp*;
+  using difference_type                 = ptrdiff_t;
 
   _LIBCPP_HIDE_FROM_ABI atomic() _NOEXCEPT = default;
 
@@ -389,9 +389,9 @@ struct atomic<_Tp> : __atomic_base<_Tp> {
   }
 
 public:
-  using __base          = __atomic_base<_Tp>;
-  using value_type      = _Tp;
-  using difference_type = value_type;
+  using __base [[__gnu__::__nodebug__]] = __atomic_base<_Tp>;
+  using value_type                      = _Tp;
+  using difference_type                 = value_type;
 
   _LIBCPP_HIDE_FROM_ABI constexpr atomic() noexcept = default;
   _LIBCPP_HIDE_FROM_ABI constexpr atomic(_Tp __d) noexcept : __base(__d) {}
diff --git a/libcxx/include/__atomic/atomic_ref.h b/libcxx/include/__atomic/atomic_ref.h
index eef15983b98331..2ff573f99aab21 100644
--- a/libcxx/include/__atomic/atomic_ref.h
+++ b/libcxx/include/__atomic/atomic_ref.h
@@ -221,7 +221,7 @@ struct __atomic_ref_base {
   _LIBCPP_HIDE_FROM_ABI void notify_all() const noexcept { std::__atomic_notify_all(*this); }
 
 protected:
-  using _Aligned_Tp [[__gnu__::__aligned__(required_alignment)]] = _Tp;
+  using _Aligned_Tp [[__gnu__::__aligned__(required_alignment), __gnu__::__nodebug__]] = _Tp;
   _Aligned_Tp* __ptr_;
 
   _LIBCPP_HIDE_FROM_ABI __atomic_ref_base(_Tp& __obj) : __ptr_(std::addressof(__obj)) {}
@@ -241,7 +241,7 @@ template <class _Tp>
 struct atomic_ref : public __atomic_ref_base<_Tp> {
   static_assert(is_trivially_copyable_v<_Tp>, "std::atomic_ref<T> requires that 'T' be a trivially copyable type");
 
-  using __base = __atomic_ref_base<_Tp>;
+  using __base [[__gnu__::__nodebug__]] = __atomic_ref_base<_Tp>;
 
   _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) {
     _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
@@ -259,7 +259,7 @@ struct atomic_ref : public __atomic_ref_base<_Tp> {
 template <class _Tp>
   requires(std::integral<_Tp> && !std::same_as<bool, _Tp>)
 struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
-  using __base = __atomic_ref_base<_Tp>;
+  using __base [[__gnu__::__nodebug__]] = __atomic_ref_base<_Tp>;
 
   using difference_type = __base::value_type;
 
@@ -305,7 +305,7 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
 template <class _Tp>
   requires std::floating_point<_Tp>
 struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
-  using __base = __atomic_ref_base<_Tp>;
+  using __base [[__gnu__::__nodebug__]] = __atomic_ref_base<_Tp>;
 
   using difference_type = __base::value_type;
 
@@ -344,7 +344,7 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
 
 template <class _Tp>
 struct atomic_ref<_Tp*> : public __atomic_ref_base<_Tp*> {
-  using __base = __atomic_ref_base<_Tp*>;
+  using __base [[__gnu__::__nodebug__]] = __atomic_ref_base<_Tp*>;
 
   using difference_type = ptrdiff_t;
 
diff --git a/libcxx/include/__atomic/atomic_sync.h b/libcxx/include/__atomic/atomic_sync.h
index a699b60d131844..73dd3ba5c5a619 100644
--- a/libcxx/include/__atomic/atomic_sync.h
+++ b/libcxx/include/__atomic/atomic_sync.h
@@ -82,7 +82,7 @@ struct __atomic_wait_backoff_impl {
   _Poll __poll_;
   memory_order __order_;
 
-  using __waitable_traits = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >;
+  using __waitable_traits [[__gnu__::__nodebug__]] = __atomic_waitable_traits<__decay_t<_AtomicWaitable> >;
 
   _LIBCPP_AVAILABILITY_SYNC
   _LIBCPP_HIDE_FROM_ABI bool
diff --git a/libcxx/include/__atomic/contention_t.h b/libcxx/include/__atomic/contention_t.h
index 65890f338ce990..11ba5b9a9d64e2 100644
--- a/libcxx/include/__atomic/contention_t.h
+++ b/libcxx/include/__atomic/contention_t.h
@@ -20,12 +20,12 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 #if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__))
-using __cxx_contention_t = int32_t;
+using __cxx_contention_t [[__gnu__::__nodebug__]] = int32_t;
 #else
-using __cxx_contention_t = int64_t;
+using __cxx_contention_t [[__gnu__::__nodebug__]] = int64_t;
 #endif // __linux__ || (_AIX && !__64BIT__)
 
-using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>;
+using __cxx_atomic_contention_t [[__gnu__::__nodebug__]] = __cxx_atomic_impl<__cxx_contention_t>;
 
 _LIBCPP_END_NAMESPACE_STD
 
diff --git a/libcxx/include/__atomic/memory_order.h b/libcxx/include/__atomic/memory_order.h
index 294121d1c4e7f4..5d51e1b15b3a75 100644
--- a/libcxx/include/__atomic/memory_order.h
+++ b/libcxx/include/__atomic/memory_order.h
@@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 // to pin the underlying type in C++20.
 enum __legacy_memory_order { __mo_relaxed, __mo_consume, __mo_acquire, __mo_release, __mo_acq_rel, __mo_seq_cst };
 
-using __memory_order_underlying_t = underlying_type<__legacy_memory_order>::type;
+using __memory_order_underlying_t [[__gnu__::__nodebug__]] = underlying_type<__legacy_memory_order>::type;
 
 #if _LIBCPP_STD_VER >= 20
 
diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference
index 22637d43974123..10fce5cc689176 100644
--- a/libcxx/include/__bit_reference
+++ b/libcxx/include/__bit_reference
@@ -45,8 +45,8 @@ struct __has_storage_type {
 
 template <class _Cp, bool = __has_storage_type<_Cp>::value>
 class __bit_reference {
-  using __storage_type    = typename _Cp::__storage_type;
-  using __storage_pointer = typename _Cp::__storage_pointer;
+  using __storage_type [[__gnu__::__nodebug__]]    = typename _Cp::__storage_type;
+  using __storage_pointer [[__gnu__::__nodebug__]] = typename _Cp::__storage_pointer;
 
   __storage_pointer __seg_;
   __storage_type __mask_;
@@ -57,7 +57,7 @@ class __bit_reference {
   friend class __bit_iterator<_Cp, false>;
 
 public:
-  using __container = typename _Cp::__self;
+  using __container [[__gnu__::__nodebug__]] = typename _Cp::__self;
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_reference(const __bit_reference&) = default;
 
@@ -137,8 +137,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(bool& __x,
 
 template <class _Cp>
 class __bit_const_reference {
-  using __storage_type    = typename _Cp::__storage_type;
-  using __storage_pointer = typename _Cp::__const_storage_pointer;
+  using __storage_type [[__gnu__::__nodebug__]]    = typename _Cp::__storage_type;
+  using __storage_pointer [[__gnu__::__nodebug__]] = typename _Cp::__const_storage_pointer;
 
   __storage_pointer __seg_;
   __storage_type __mask_;
@@ -147,7 +147,7 @@ class __bit_const_reference {
   friend class __bit_iterator<_Cp, true>;
 
 public:
-  using __container = typename _Cp::__self;
+  using __container [[__gnu__::__nodebug__]] = typename _Cp::__self;
 
   _LIBCPP_HIDE_FROM_ABI __bit_const_reference(const __bit_const_reference&) = default;
   __bit_const_reference& operator=(const __bit_const_reference&)            = delete;
@@ -589,10 +589,10 @@ inline _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cr, false> swap_ranges(
 
 template <class _Cp>
 struct __bit_array {
-  using difference_type   = typename _Cp::difference_type;
-  using __storage_type    = typename _Cp::__storage_type;
-  using __storage_pointer = typename _Cp::__storage_pointer;
-  using iterator          = typename _Cp::iterator;
+  using difference_type [[__gnu__::__nodebug__]]   = typename _Cp::difference_type;
+  using __storage_type [[__gnu__::__nodebug__]]    = typename _Cp::__storage_type;
+  using __storage_pointer [[__gnu__::__nodebug__]] = typename _Cp::__storage_pointer;
+  using iterator [[__gnu__::__nodebug__]]          = typename _Cp::iterator;
 
   static const unsigned __bits_per_word = _Cp::__bits_per_word;
   static const unsigned _Np             = 4;
@@ -792,8 +792,8 @@ public:
   using iterator_category = random_access_iterator_tag;
 
 private:
-  using __storage_type = typename _Cp::__storage_type;
-  using __storage_pointer =
+  using __storage_type [[__gnu__::__nodebug__]] = typename _Cp::__storage_type;
+  using __storage_pointer [[__gnu__::__nodebug__]] =
       __conditional_t<_IsConst, typename _Cp::__const_storage_pointer, typename _Cp::__storage_pointer>;
 
   static const unsigned __bits_per_word = _Cp::__bits_per_word;
di...
[truncated]

@philnik777 philnik777 force-pushed the nodebug_on_internal_aliases branch 3 times, most recently from 8ba0878 to 3b77601 Compare December 17, 2024 12:09
@dwblaikie
Copy link
Collaborator

I'd also encourage applying this to all the non-internal type aliases in type traits. We added a lot of these to upstream libcxx after looking at the DWARF size cost when Google was migrating to libcxx, but it doesn't seem to have been applied entirely consistently. 82 using type have NODEBUG out of a total of 435 instances of using type.

Ping on this ^

@philnik777
Copy link
Contributor Author

I'd also encourage applying this to all the non-internal type aliases in type traits. We added a lot of these to upstream libcxx after looking at the DWARF size cost when Google was migrating to libcxx, but it doesn't seem to have been applied entirely consistently. 82 using type have NODEBUG out of a total of 435 instances of using type.

Ping on this ^

I have a follow-up patch for this.

@philnik777 philnik777 force-pushed the nodebug_on_internal_aliases branch 3 times, most recently from efff5e8 to 0881547 Compare December 20, 2024 15:07
@philnik777 philnik777 force-pushed the nodebug_on_internal_aliases branch from 0881547 to b0cf9db Compare January 2, 2025 16:35
@philnik777 philnik777 force-pushed the nodebug_on_internal_aliases branch from b0cf9db to 3092c37 Compare January 2, 2025 17:45
@ldionne ldionne changed the title [libc++] Put [[gnu::nodebug]] on all internal aliases [libc++] Put _LIBCPP_NODEBUG on all internal aliases Jan 8, 2025
@ldionne ldionne merged commit f695852 into llvm:main Jan 8, 2025
62 checks passed
@philnik777 philnik777 deleted the nodebug_on_internal_aliases branch January 8, 2025 21:56
philnik777 added a commit to philnik777/llvm-project that referenced this pull request Jan 10, 2025
This should be reverted once the crash reported in llvm#118710 has been
analyzed.
@philnik777
Copy link
Contributor Author

This has been in the tree for all of a day. Is this really going to cause a problem so quickly?

This patch touches a lot of files and we already had two cases where this caused issues (specifically, the check wasn't run on the PRs yet and then caught issues after landing).

And clang crashing seems kind of worse – there are reports of several distinct problems on this PR. Why is this exempt from llvm's revert-to-green policy?

This isn't exempt from the policy. However, my experience has been that if you revert before getting an actual reproducer you don't get one unless you push really hard. This is of course not always the case, but it's also not exactly a rare thing. I usually don't consider "here is a log" a reproducer, since the failures almost always are way outside my field of expertise (e.g. lldb in this case), which means I have to either spend lots of time figuring our what's actually going on, or ask the person who reported the issue and hope that they respond. In this very instance I didn't get a reproducer from either the original person who reported the issue or the person who asked for the revert. A third person had to give me something to actually look at. If I had reverted I most likely wouldn't have gotten that reproducer simply because @aeubanks probably would have taken a look and noticed that it's already been reverted and then not noticing that I didn't actually have a reproducer.

(FYI I've uploaded #122393 to fix the crashes temporarily)

philnik777 added a commit that referenced this pull request Jan 10, 2025
This should be reverted once the crash reported in #118710 has been
analyzed.
@Andarwinux
Copy link
Contributor

My crash report is an lld-generated report.tar, which should be easier to reproduce than others (just run lld-link @response.txt)

@philnik777
Copy link
Contributor Author

My crash report is an lld-generated report.tar, which should be easier to reproduce than others (just run lld-link @response.txt)

That's very possible. Unfortunately, I don't have a very firm grasp on what lld actually does and how it would map to source code. libc++ is most likely the only part I can work in with any amount of efficiency.

@Andarwinux
Copy link
Contributor

My crash report is an lld-generated report.tar, which should be easier to reproduce than others (just run lld-link @response.txt)

That's very possible. Unfortunately, I don't have a very firm grasp on what lld actually does and how it would map to source code. libc++ is most likely the only part I can work in with any amount of efficiency.

lld is a linker, this PR causes clang or lld to crash inside llvm, for my case, since libc++ is built with LTO, the crash is delayed until lld performs LTO, so a standalone one-click reproducer can be generated with -Wl,-reproduce.
Since the reproducer doesn't have any libc++ headers, this probably won't help in debugging problems with lib++, but should help in understanding why the crash occurs.

@ldionne
Copy link
Member

ldionne commented Jan 10, 2025

Are we able to narrow down to which declarations are causing problems? Reverting this is going to create problems for people who monitor their debug info sizes.

This has been in the tree for all of a day. Is this really going to cause a problem so quickly?

Reverting this patch itself would not cause an issue for people monitoring their debug info size, but the plan was not to revert only this patch, it was to make _LIBCPP_NODEBUG a no-op. That has impact on existing typedefs that were marked with _LIBCPP_NODEBUG previously as well, and will cause debug info sizes to jump up for people monitoring them.

That being said, I think that's the correct path forward temporarily until this is investigated.

@nico
Copy link
Contributor

nico commented Jan 10, 2025

This isn't exempt from the policy. However, my experience has been that if you revert before getting an actual reproducer you don't get one unless you push really hard.

FWIW, I completely agree that a reproducer is a prerequisite for reverting. (But it looks like there were several reproducers here already.)

(FYI I've uploaded #122393 to fix the crashes temporarily)

Thanks! :)

BaiXilin pushed a commit to BaiXilin/llvm-fix-vnni-instr-types that referenced this pull request Jan 12, 2025
This should be reverted once the crash reported in llvm#118710 has been
analyzed.
@dwblaikie
Copy link
Collaborator

I think the missing earlier invariant check (in clang/DIBuilder/etc) is "the elements field of a DICompositeType must not contain null entries" - once an assertion is added for that, well, for a narrower subset of it:

    return;
  SourceLocation Loc = TD->getLocation();
  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateFile(Loc));
  assert(nestedType); // adding this line
  elements.push_back(nestedType);

Then a reducer that triggers this assertion comes out to:

struct t3 {
  using trivially_relocatable [[__gnu__::__nodebug__]] = void;
};
t3 v;

The fix is simple enough - instead of an assert in the above code, we could add a conditional that only adds the element if the DIType* produced is non-null.

Anyone else want to do that, or shall I?

@dwblaikie
Copy link
Collaborator

Oh, extra wrinkle. This only reproduces with codeview output, so compiled with:

 clang++-tot test.cpp -c -target i686-windows-msvc -S -o - -emit-llvm -g

Shows the problem.

@dwblaikie
Copy link
Collaborator

Fix committed in 504dd57 - though I'm not clear on how many distinct issues there might be here. Sounded like @Michael137 was tracking an lldb issue too?

@Michael137
Copy link
Member

Fix committed in 504dd57 - though I'm not clear on how many distinct issues there might be here. Sounded like @Michael137 was tracking an lldb issue too?

Yea there's a Clang crash with -gmodules for types annotated with nodebug. Was going to put up a fix tomorrow

@dwblaikie
Copy link
Collaborator

Fix committed in 504dd57 - though I'm not clear on how many distinct issues there might be here. Sounded like @Michael137 was tracking an lldb issue too?

Yea there's a Clang crash with -gmodules for types annotated with nodebug. Was going to put up a fix tomorrow

any update on this?

@Michael137
Copy link
Member

Fix committed in 504dd57 - though I'm not clear on how many distinct issues there might be here. Sounded like @Michael137 was tracking an lldb issue too?

Yea there's a Clang crash with -gmodules for types annotated with nodebug. Was going to put up a fix tomorrow

any update on this?

I'll go ahead with the fix I mentioned above for now. Just writing up a test now

Michael137 added a commit to Michael137/llvm-project that referenced this pull request Jan 16, 2025
…ed nodebug

Fixes one of the crashes uncovered by
llvm#118710

`getOrCreateStandaloneType` asserts that a `DIType` was created for the
requested type. If the `Decl` was marked `nodebug`, however, we can't
generate debug-info for it, so we would previously trigger the assert.
For now keep the assertion around and check the `nodebug` at the
callsite.
@Michael137
Copy link
Member

#123253

Michael137 added a commit that referenced this pull request Jan 17, 2025
…ed nodebug (#123253)

Fixes one of the crashes uncovered by
#118710

`getOrCreateStandaloneType` asserts that a `DIType` was created for the
requested type. If the `Decl` was marked `nodebug`, however, we can't
generate debug-info for it, so we would previously trigger the assert.
For now keep the assertion around and check the `nodebug` at the
callsite.
github-actions bot pushed a commit to arm/arm-toolchain that referenced this pull request Jan 17, 2025
… types marked nodebug (#123253)

Fixes one of the crashes uncovered by
llvm/llvm-project#118710

`getOrCreateStandaloneType` asserts that a `DIType` was created for the
requested type. If the `Decl` was marked `nodebug`, however, we can't
generate debug-info for it, so we would previously trigger the assert.
For now keep the assertion around and check the `nodebug` at the
callsite.
ldionne pushed a commit that referenced this pull request Jan 21, 2025
…BUG (#122175)

In #118710 we've added ``_LIBCPP_NODEBUG`` to all internal aliases, but
didn't actually document it. This patch adds documentation by adding the
new requirement and reasoning to the coding guidelines.
Michael137 added a commit to swiftlang/llvm-project that referenced this pull request Mar 14, 2025
…ed nodebug (llvm#123253)

Fixes one of the crashes uncovered by
llvm#118710

`getOrCreateStandaloneType` asserts that a `DIType` was created for the
requested type. If the `Decl` was marked `nodebug`, however, we can't
generate debug-info for it, so we would previously trigger the assert.
For now keep the assertion around and check the `nodebug` at the
callsite.

(cherry picked from commit 30e276d)
Michael137 added a commit to swiftlang/llvm-project that referenced this pull request Mar 14, 2025
…ed nodebug (llvm#123253)

Fixes one of the crashes uncovered by
llvm#118710

`getOrCreateStandaloneType` asserts that a `DIType` was created for the
requested type. If the `Decl` was marked `nodebug`, however, we can't
generate debug-info for it, so we would previously trigger the assert.
For now keep the assertion around and check the `nodebug` at the
callsite.

(cherry picked from commit 30e276d)
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.