Adding bad_array_length to libc++

llvm-svn: 190478
This commit is contained in:
Marshall Clow 2013-09-11 01:38:42 +00:00
parent 3369612808
commit 6e8ebb2ce9
2 changed files with 40 additions and 1 deletions

View File

@ -27,6 +27,18 @@ public:
virtual const char* what() const noexcept;
};
class bad_array_length : public bad_alloc // C++14
{
public:
bad_array_length() noexcept;
};
class bad_array_new_length : public bad_alloc
{
public:
bad_array_new_length() noexcept;
};
struct nothrow_t {};
extern const nothrow_t nothrow;
typedef void (*new_handler)();
@ -81,6 +93,17 @@ public:
virtual const char* what() const _NOEXCEPT;
};
#if defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
class _LIBCPP_EXCEPTION_ABI bad_array_length
: public bad_alloc
{
public:
bad_array_length() _NOEXCEPT;
virtual ~bad_array_length() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
#endif
_LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
struct _LIBCPP_TYPE_VIS nothrow_t {};

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
#define _LIBCPP_BUILDING_NEW
#include <stdlib.h>
#include "new"
@ -186,13 +188,27 @@ bad_array_new_length::~bad_array_new_length() _NOEXCEPT
{
}
const char*
bad_array_length::what() const _NOEXCEPT
{
return "bad_array_length";
}
bad_array_length::bad_array_length() _NOEXCEPT
{
}
bad_array_length::~bad_array_length() _NOEXCEPT
{
}
const char*
bad_array_new_length::what() const _NOEXCEPT
{
return "bad_array_new_length";
}
#endif
#endif // _LIBCPPABI_VERSION
void
__throw_bad_alloc()