summaryrefslogtreecommitdiffstats
path: root/libcxx/include/vector
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2016-08-25 15:09:01 +0000
committerMarshall Clow <mclow.lists@gmail.com>2016-08-25 15:09:01 +0000
commitd437fa5c8c1185af695b87cdd5ea83aa4a6e7382 (patch)
tree2fc9b60f206ef14e242a52af06f8f95b95693962 /libcxx/include/vector
parentb41b990e05797d1d69ea735bb168893974757422 (diff)
downloadbcm5719-llvm-d437fa5c8c1185af695b87cdd5ea83aa4a6e7382.tar.gz
bcm5719-llvm-d437fa5c8c1185af695b87cdd5ea83aa4a6e7382.zip
Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855.
llvm-svn: 279744
Diffstat (limited to 'libcxx/include/vector')
-rw-r--r--libcxx/include/vector16
1 files changed, 4 insertions, 12 deletions
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 16d48ae58d1..cbe86a412f9 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -290,30 +290,22 @@ class __vector_base_common
{
protected:
_LIBCPP_ALWAYS_INLINE __vector_base_common() {}
- void __throw_length_error() const;
- void __throw_out_of_range() const;
+ _LIBCPP_NORETURN void __throw_length_error() const;
+ _LIBCPP_NORETURN void __throw_out_of_range() const;
};
template <bool __b>
void
__vector_base_common<__b>::__throw_length_error() const
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw length_error("vector");
-#else
- assert(!"vector length_error");
-#endif
+ _VSTD::__throw_length_error("vector");
}
template <bool __b>
void
__vector_base_common<__b>::__throw_out_of_range() const
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw out_of_range("vector");
-#else
- assert(!"vector out_of_range");
-#endif
+ _VSTD::__throw_out_of_range("vector");
}
#ifdef _LIBCPP_MSVC
OpenPOWER on IntegriCloud