diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-01 16:31:47 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-01 16:31:47 -0700 |
| commit | bd680139d084b673d1f56d0e63e01936c4680a91 (patch) | |
| tree | f066c89b83db70814a23e5be9731686610fea92c /lib/libcxx/include/__debug | |
| parent | c89dd15e1be4959800dc7092d7dd4375253db7bc (diff) | |
| download | zig-bd680139d084b673d1f56d0e63e01936c4680a91.tar.gz zig-bd680139d084b673d1f56d0e63e01936c4680a91.zip | |
update libcxx to llvm 14.0.6
Diffstat (limited to 'lib/libcxx/include/__debug')
| -rw-r--r-- | lib/libcxx/include/__debug | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/libcxx/include/__debug b/lib/libcxx/include/__debug index 771e431632..a1e21a7032 100644 --- a/lib/libcxx/include/__debug +++ b/lib/libcxx/include/__debug @@ -1,5 +1,5 @@ // -*- C++ -*- -//===--------------------------- __debug ----------------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -12,6 +12,7 @@ #include <__config> #include <iosfwd> +#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -22,9 +23,9 @@ #endif #if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY) -# include <cstdlib> -# include <cstdio> # include <cstddef> +# include <cstdio> +# include <cstdlib> #endif #if _LIBCPP_DEBUG_LEVEL == 0 @@ -34,7 +35,7 @@ # define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0) # define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m))) #elif _LIBCPP_DEBUG_LEVEL == 2 -# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(x, m) +# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(__libcpp_is_constant_evaluated() || (x), m) # define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m))) #else # error _LIBCPP_DEBUG_LEVEL must be one of 0, 1, 2 @@ -268,6 +269,26 @@ _LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db(); #endif // _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY) +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_c(_Tp* __c) { +#if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) + __get_db()->__insert_c(__c); +#else + (void)(__c); +#endif +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_i(_Tp* __i) { +#if _LIBCPP_DEBUG_LEVEL == 2 + if (!__libcpp_is_constant_evaluated()) + __get_db()->__insert_i(__i); +#else + (void)(__i); +#endif +} + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_DEBUG_H |
