aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src/stdexcept.cpp
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2023-07-11 14:55:26 -0400
committerLouis Dionne <ldionne.2@gmail.com>2023-08-10 08:31:10 -0400
commit280d68e7f808af74ca48cfeb849e6ac910f96e5c (patch)
tree3bb50beaff70b63dee41df33901accf510dfea1b /libcxx/src/stdexcept.cpp
parent042abb477c3ff880ea66b36d81388eae05b0f457 (diff)
downloadllvm-280d68e7f808af74ca48cfeb849e6ac910f96e5c.zip
llvm-280d68e7f808af74ca48cfeb849e6ac910f96e5c.tar.gz
llvm-280d68e7f808af74ca48cfeb849e6ac910f96e5c.tar.bz2
[libc++] Clean up mess around __throw_runtime_error
We were defining the function in locale.cpp, and we actually had two overloads for it. This is pretty confusing given that one was static and not exported from the dylib, and the other one was. Instead, use the vanilla __throw_runtime_error function everywhere even though that adds a tiny bit of code duplication. Differential Revision: https://reviews.llvm.org/D155008
Diffstat (limited to 'libcxx/src/stdexcept.cpp')
-rw-r--r--libcxx/src/stdexcept.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/libcxx/src/stdexcept.cpp b/libcxx/src/stdexcept.cpp
index d5c9173..bc25c0f 100644
--- a/libcxx/src/stdexcept.cpp
+++ b/libcxx/src/stdexcept.cpp
@@ -6,12 +6,25 @@
//
//===----------------------------------------------------------------------===//
+#include <__verbose_abort>
#include <new>
#include <stdexcept>
#include <string>
#ifdef _LIBCPP_ABI_VCRUNTIME
-#include "support/runtime/stdexcept_vcruntime.ipp"
+# include "support/runtime/stdexcept_vcruntime.ipp"
#else
-#include "support/runtime/stdexcept_default.ipp"
+# include "support/runtime/stdexcept_default.ipp"
#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+_LIBCPP_NORETURN void __throw_runtime_error(const char* msg) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw runtime_error(msg);
+#else
+ _LIBCPP_VERBOSE_ABORT("runtime_error was thrown in -fno-exceptions mode with message \"%s\"", msg);
+#endif
+}
+
+_LIBCPP_END_NAMESPACE_STD