aboutsummaryrefslogtreecommitdiff
path: root/lib/libcxx/src/string.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-08-11 17:34:16 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-09-19 09:37:31 -0700
commit5d4439cc3e9dc9196fc109552f36594ad97542c5 (patch)
treeb0ed2b36b213c5c47cd373327bb91cbf9e6d2205 /lib/libcxx/src/string.cpp
parent9ddfacd8e62abd80b25619dd852ee811dad5f7b6 (diff)
downloadzig-5d4439cc3e9dc9196fc109552f36594ad97542c5.tar.gz
zig-5d4439cc3e9dc9196fc109552f36594ad97542c5.zip
libcxx: update to LLVM 17
release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8 This adds the flag `-D_LIBCPP_PSTL_CPU_BACKEND_SERIAL`. A future enhancement could possibly pass something different if there is a compelling parallel implementation. That libdispatch one might be worth looking into.
Diffstat (limited to 'lib/libcxx/src/string.cpp')
-rw-r--r--lib/libcxx/src/string.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/libcxx/src/string.cpp b/lib/libcxx/src/string.cpp
index db211b2242..4f3de555e3 100644
--- a/lib/libcxx/src/string.cpp
+++ b/lib/libcxx/src/string.cpp
@@ -12,7 +12,6 @@
#include <cstdlib>
#include <limits>
#include <stdexcept>
-#include <stdio.h>
#include <string>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
@@ -61,22 +60,12 @@ template string operator+<char, char_traits<char>, allocator<char>>(char const*,
namespace
{
-template<typename T>
-inline void throw_helper(const string& msg) {
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw T(msg);
-#else
- fprintf(stderr, "%s\n", msg.c_str());
- _VSTD::abort();
-#endif
-}
-
inline void throw_from_string_out_of_range(const string& func) {
- throw_helper<out_of_range>(func + ": out of range");
+ std::__throw_out_of_range((func + ": out of range").c_str());
}
inline void throw_from_string_invalid_arg(const string& func) {
- throw_helper<invalid_argument>(func + ": no conversion");
+ std::__throw_invalid_argument((func + ": no conversion").c_str());
}
// as_integer
@@ -357,7 +346,7 @@ S i_to_string(V v) {
constexpr size_t bufsize = numeric_limits<V>::digits10 + 2; // +1 for minus, +1 for digits10
char buf[bufsize];
const auto res = to_chars(buf, buf + bufsize, v);
- _LIBCPP_ASSERT(res.ec == errc(), "bufsize must be large enough to accomodate the value");
+ _LIBCPP_ASSERT_INTERNAL(res.ec == errc(), "bufsize must be large enough to accomodate the value");
return S(buf, res.ptr);
}