[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
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