[libcxx-commits] [PATCH] D131082: [libcxx] Add _LIBCPP_NODEBUG to std::conditional related typedfs
David Blaikie via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 3 10:19:29 PDT 2022
dblaikie created this revision.
Herald added a project: All.
dblaikie requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Looks like std::conditional wasn't included in 14d4869209cc8ff9a53aaa5a59d6409fbc1c5f5d
(& maybe other typedefs that should be using this technique either got
missed or have regressed since that change was made)
This was noticed by a 1.4% clang.dwp regression due to
f4fb72e6d4cee1097e6606e66232fe55e793cd86 <https://reviews.llvm.org/rGf4fb72e6d4cee1097e6606e66232fe55e793cd86> introducing more instantiations
of std::conditional - this change reduces that regression to 0.6% at
least.
I'm also looking at other instantiations caused by that change that
might be able to be addressed - but a quick grep shows ~200 "type"
typedefs missing _LIBCPP_NODEBUG, so maybe a systematic application of
the typedef might be suitable?
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D131082
Files:
libcxx/include/__type_traits/conditional.h
Index: libcxx/include/__type_traits/conditional.h
===================================================================
--- libcxx/include/__type_traits/conditional.h
+++ libcxx/include/__type_traits/conditional.h
@@ -36,17 +36,22 @@
using _If _LIBCPP_NODEBUG = typename _IfImpl<_Cond>::template _Select<_IfRes, _ElseRes>;
template <bool _Bp, class _If, class _Then>
- struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;};
+struct _LIBCPP_TEMPLATE_VIS conditional {
+ _LIBCPP_NODEBUG typedef _If type;
+};
template <class _If, class _Then>
- struct _LIBCPP_TEMPLATE_VIS conditional<false, _If, _Then> {typedef _Then type;};
+struct _LIBCPP_TEMPLATE_VIS conditional<false, _If, _Then> {
+ _LIBCPP_NODEBUG typedef _Then type;
+};
#if _LIBCPP_STD_VER > 11
template <bool _Bp, class _IfRes, class _ElseRes>
-using conditional_t = typename conditional<_Bp, _IfRes, _ElseRes>::type;
+using conditional_t _LIBCPP_NODEBUG = typename conditional<_Bp, _IfRes, _ElseRes>::type;
#endif
// Helper so we can use "conditional_t" in all language versions.
-template <bool _Bp, class _If, class _Then> using __conditional_t = typename conditional<_Bp, _If, _Then>::type;
+template <bool _Bp, class _If, class _Then>
+using __conditional_t _LIBCPP_NODEBUG = typename conditional<_Bp, _If, _Then>::type;
_LIBCPP_END_NAMESPACE_STD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131082.449698.patch
Type: text/x-patch
Size: 1342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220803/17316c6c/attachment-0001.bin>
More information about the libcxx-commits
mailing list