[libc++] Move everything related solely to _LIBCPP_ASSERT to its own file
This is the first step towards disentangling the debug mode and assertions
in libc++. This patch doesn't make any functional change: it simply moves
_LIBCPP_ASSERT-related stuff to its own file so as to make it clear that
libc++ assertions and the debug mode are different things. Future patches
will make it possible to enable assertions without enabling the debug
mode.
Differential Revision: https://reviews.llvm.org/D119769
NOKEYCHECK=True
GitOrigin-RevId: f87aa19be64499308fc18f92d048c5fa2d3064d9
diff --git a/src/debug.cpp b/src/debug.cpp
index 14a75b1..8f1d328 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include <__assert>
#include <__config>
#include <__debug>
#include <__hash_table>
@@ -23,26 +24,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-std::string __libcpp_debug_info::what() const {
- string msg = __file_;
- msg += ":" + to_string(__line_) + ": _LIBCPP_ASSERT '";
- msg += __pred_;
- msg += "' failed. ";
- msg += __msg_;
- return msg;
-}
-_LIBCPP_NORETURN void __libcpp_abort_debug_function(__libcpp_debug_info const& info) {
- std::fprintf(stderr, "%s\n", info.what().c_str());
- std::abort();
-}
-
-constinit __libcpp_debug_function_type __libcpp_debug_function = __libcpp_abort_debug_function;
-
-bool __libcpp_set_debug_function(__libcpp_debug_function_type __func) {
- __libcpp_debug_function = __func;
- return true;
-}
-
_LIBCPP_FUNC_VIS
__libcpp_db*
__get_db()