diff options
Diffstat (limited to 'libcxx/include')
| -rw-r--r-- | libcxx/include/ios | 10 | ||||
| -rw-r--r-- | libcxx/include/map | 8 | ||||
| -rw-r--r-- | libcxx/include/unordered_map | 8 |
3 files changed, 14 insertions, 12 deletions
diff --git a/libcxx/include/ios b/libcxx/include/ios index 96336396302..96e84eb3835 100644 --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -425,6 +425,16 @@ public: virtual ~failure() throw(); }; +_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY +void __throw_failure(char const* __msg) { +#ifndef _LIBCPP_NO_EXCEPTIONS + throw ios_base::failure(__msg); +#else + ((void)__msg); + _VSTD::abort(); +#endif +} + class _LIBCPP_TYPE_VIS ios_base::Init { public: diff --git a/libcxx/include/map b/libcxx/include/map index 47f5c678bcc..e21dd5a8454 100644 --- a/libcxx/include/map +++ b/libcxx/include/map @@ -1535,10 +1535,8 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) { __parent_pointer __parent; __node_base_pointer& __child = __tree_.__find_equal(__parent, __k); -#ifndef _LIBCPP_NO_EXCEPTIONS if (__child == nullptr) - throw out_of_range("map::at: key not found"); -#endif // _LIBCPP_NO_EXCEPTIONS + __throw_out_of_range("map::at: key not found"); return static_cast<__node_pointer>(__child)->__value_.__get_value().second; } @@ -1548,10 +1546,8 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const { __parent_pointer __parent; __node_base_pointer __child = __tree_.__find_equal(__parent, __k); -#ifndef _LIBCPP_NO_EXCEPTIONS if (__child == nullptr) - throw out_of_range("map::at: key not found"); -#endif // _LIBCPP_NO_EXCEPTIONS + __throw_out_of_range("map::at: key not found"); return static_cast<__node_pointer>(__child)->__value_.__get_value().second; } diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map index 87278b07d74..7ae9805d81d 100644 --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -1602,10 +1602,8 @@ _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) { iterator __i = find(__k); -#ifndef _LIBCPP_NO_EXCEPTIONS if (__i == end()) - throw out_of_range("unordered_map::at: key not found"); -#endif // _LIBCPP_NO_EXCEPTIONS + __throw_out_of_range("unordered_map::at: key not found"); return __i->second; } @@ -1614,10 +1612,8 @@ const _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const { const_iterator __i = find(__k); -#ifndef _LIBCPP_NO_EXCEPTIONS if (__i == end()) - throw out_of_range("unordered_map::at: key not found"); -#endif // _LIBCPP_NO_EXCEPTIONS + __throw_out_of_range("unordered_map::at: key not found"); return __i->second; } |

