Followon to r279744. Find the other exception types and make __throw_XXX routines (and call them). Remove the generic __libcpp_throw routine, since no one uses it anymore.
llvm-svn: 279763
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 0fc8cec796387575c0c4a2635ba5579f60deeb75
diff --git a/include/experimental/filesystem b/include/experimental/filesystem
index 0075ad2..7211c6b 100644
--- a/include/experimental/filesystem
+++ b/include/experimental/filesystem
@@ -1176,6 +1176,17 @@
shared_ptr<_Storage> __paths_;
};
+template <class... _Args>
+_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
+void __throw_filesystem_error(_Args && ...__args)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw filesystem_error(std::forward<_Args>(__args)...);
+#else
+ _VSTD::abort();
+#endif
+}
+
// operational functions
_LIBCPP_FUNC_VIS
diff --git a/include/experimental/memory_resource b/include/experimental/memory_resource
index 9b34521..1a2cb10 100644
--- a/include/experimental/memory_resource
+++ b/include/experimental/memory_resource
@@ -182,9 +182,9 @@
_LIBCPP_INLINE_VISIBILITY
_ValueType* allocate(size_t __n) {
if (__n > max_size()) {
- __libcpp_throw(length_error(
+ __throw_length_error(
"std::experimental::pmr::polymorphic_allocator<T>::allocate(size_t n)"
- " 'n' exceeds maximum supported size"));
+ " 'n' exceeds maximum supported size");
}
return static_cast<_ValueType*>(
__res_->allocate(__n * sizeof(_ValueType), alignof(_ValueType))
@@ -383,9 +383,9 @@
virtual void * do_allocate(size_t __bytes, size_t)
{
if (__bytes > __max_size()) {
- __libcpp_throw(length_error(
+ __throw_length_error(
"std::experimental::pmr::resource_adaptor<T>::do_allocate(size_t bytes, size_t align)"
- " 'bytes' exceeds maximum supported size"));
+ " 'bytes' exceeds maximum supported size");
}
size_t __s = __aligned_allocation_size(__bytes, _MaxAlign) / _MaxAlign;
return __alloc_.allocate(__s);
diff --git a/include/experimental/string_view b/include/experimental/string_view
index f8b5128..a62fe6e 100644
--- a/include/experimental/string_view
+++ b/include/experimental/string_view
@@ -281,7 +281,7 @@
const_reference at(size_type __pos) const
{
return __pos >= size()
- ? (__libcpp_throw(out_of_range("string_view::at")), __data[0])
+ ? (__throw_out_of_range("string_view::at"), __data[0])
: __data[__pos];
}
@@ -352,7 +352,7 @@
size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
{
if ( __pos > size())
- __libcpp_throw(out_of_range("string_view::copy"));
+ __throw_out_of_range("string_view::copy");
size_type __rlen = _VSTD::min( __n, size() - __pos );
_VSTD::copy_n(begin() + __pos, __rlen, __s );
return __rlen;