summaryrefslogtreecommitdiffstats
path: root/libcxx/include/array
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/array
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/array')
-rw-r--r--libcxx/include/array16
1 files changed, 3 insertions, 13 deletions
diff --git a/libcxx/include/array b/libcxx/include/array
index 719286d52ea..d3f8463cf66 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -108,9 +108,6 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
#include <iterator>
#include <algorithm>
#include <stdexcept>
-#if defined(_LIBCPP_NO_EXCEPTIONS)
- #include <cassert>
-#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -209,11 +206,8 @@ typename array<_Tp, _Size>::reference
array<_Tp, _Size>::at(size_type __n)
{
if (__n >= _Size)
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw out_of_range("array::at");
-#else
- assert(!"array::at out_of_range");
-#endif
+ __throw_out_of_range("array::at");
+
return __elems_[__n];
}
@@ -223,11 +217,7 @@ typename array<_Tp, _Size>::const_reference
array<_Tp, _Size>::at(size_type __n) const
{
if (__n >= _Size)
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw out_of_range("array::at");
-#else
- assert(!"array::at out_of_range");
-#endif
+ __throw_out_of_range("array::at");
return __elems_[__n];
}
OpenPOWER on IntegriCloud