Apply [[nodebug]] to typedefs throughout the STL.
When applied to a typedef or alias template, the [[nodebug]] attribute
makes the typedef transparent to the debugger, so instead of seeing
`std::__function::__alloc_func<remove_reference<void(&)()>::type,
allocator<remove_reference<void(&)()>, void()>::_Target` you see
`void(&)()` as the type of the variable in your debugger.
Removing all this SFINAE noise from debug info has huge binary size
wins, in addition to improving the readability.
For now this change is on by default. Users can override it by
specifying -D_LIBCPP_NODEBUG_TYPE=
llvm-svn: 363117
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 14d4869209cc8ff9a53aaa5a59d6409fbc1c5f5d
diff --git a/include/utility b/include/utility
index 3eea6f3..4e38678 100644
--- a/include/utility
+++ b/include/utility
@@ -349,7 +349,7 @@
}
#else
template <bool _Val>
- using _EnableB = typename enable_if<_Val, bool>::type;
+ using _EnableB _LIBCPP_NODEBUG_TYPE = typename enable_if<_Val, bool>::type;
struct _CheckArgs {
template <class _U1, class _U2>
@@ -376,7 +376,7 @@
};
template <bool _MaybeEnable>
- using _CheckArgsDep = typename conditional<
+ using _CheckArgsDep _LIBCPP_NODEBUG_TYPE = typename conditional<
_MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type;
struct _CheckTupleLikeConstructor {
@@ -398,7 +398,7 @@
};
template <class _Tuple>
- using _CheckTLC = typename conditional<
+ using _CheckTLC _LIBCPP_NODEBUG_TYPE = typename conditional<
__tuple_like_with_size<_Tuple, 2>::value
&& !is_same<typename decay<_Tuple>::type, pair>::value,
_CheckTupleLikeConstructor,
@@ -637,10 +637,10 @@
}
template <class _Tp>
-struct __unwrap_reference { typedef _Tp type; };
+struct __unwrap_reference { typedef _LIBCPP_NODEBUG_TYPE _Tp type; };
template <class _Tp>
-struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _Tp& type; };
+struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _LIBCPP_NODEBUG_TYPE _Tp& type; };
#if _LIBCPP_STD_VER > 17
template <class _Tp>
@@ -695,13 +695,13 @@
template <class _T1, class _T2>
struct _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> >
{
- typedef _T1 type;
+ typedef _LIBCPP_NODEBUG_TYPE _T1 type;
};
template <class _T1, class _T2>
struct _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> >
{
- typedef _T2 type;
+ typedef _LIBCPP_NODEBUG_TYPE _T2 type;
};
template <size_t _Ip> struct __get_pair;
@@ -880,11 +880,11 @@
#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
template <class _Tp, _Tp _Ep>
-using __make_integer_sequence = __make_integer_seq<integer_sequence, _Tp, _Ep>;
+using __make_integer_sequence _LIBCPP_NODEBUG_TYPE = __make_integer_seq<integer_sequence, _Tp, _Ep>;
#else
-template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked =
+template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked _LIBCPP_NODEBUG_TYPE =
typename __detail::__make<_Np>::type::template __convert<integer_sequence, _Tp>;
template <class _Tp, _Tp _Ep>
@@ -895,11 +895,11 @@
static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
// Workaround GCC bug by preventing bad installations when 0 <= _Ep
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929
- typedef __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
+ typedef _LIBCPP_NODEBUG_TYPE __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
};
template <class _Tp, _Tp _Ep>
-using __make_integer_sequence = typename __make_integer_sequence_checked<_Tp, _Ep>::type;
+using __make_integer_sequence _LIBCPP_NODEBUG_TYPE = typename __make_integer_sequence_checked<_Tp, _Ep>::type;
#endif
@@ -1590,29 +1590,29 @@
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Hash>
-using __check_hash_requirements = integral_constant<bool,
+using __check_hash_requirements _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
is_copy_constructible<_Hash>::value &&
is_move_constructible<_Hash>::value &&
__invokable_r<size_t, _Hash, _Key const&>::value
>;
template <class _Key, class _Hash = std::hash<_Key> >
-using __has_enabled_hash = integral_constant<bool,
+using __has_enabled_hash _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
__check_hash_requirements<_Key, _Hash>::value &&
is_default_constructible<_Hash>::value
>;
#if _LIBCPP_STD_VER > 14
template <class _Type, class>
-using __enable_hash_helper_imp = _Type;
+using __enable_hash_helper_imp _LIBCPP_NODEBUG_TYPE = _Type;
template <class _Type, class ..._Keys>
-using __enable_hash_helper = __enable_hash_helper_imp<_Type,
+using __enable_hash_helper _LIBCPP_NODEBUG_TYPE = __enable_hash_helper_imp<_Type,
typename enable_if<__all<__has_enabled_hash<_Keys>::value...>::value>::type
>;
#else
template <class _Type, class ...>
-using __enable_hash_helper = _Type;
+using __enable_hash_helper _LIBCPP_NODEBUG_TYPE = _Type;
#endif
#endif // !_LIBCPP_CXX03_LANG