[libcxx] r190478 - Adding bad_array_length to libc++
Marshall Clow
mclow.lists at gmail.com
Tue Sep 10 18:38:42 PDT 2013
Author: marshall
Date: Tue Sep 10 20:38:42 2013
New Revision: 190478
URL: http://llvm.org/viewvc/llvm-project?rev=190478&view=rev
Log:
Adding bad_array_length to libc++
Modified:
libcxx/trunk/include/new
libcxx/trunk/src/new.cpp
Modified: libcxx/trunk/include/new
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=190478&r1=190477&r2=190478&view=diff
==============================================================================
--- libcxx/trunk/include/new (original)
+++ libcxx/trunk/include/new Tue Sep 10 20:38:42 2013
@@ -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 {};
Modified: libcxx/trunk/src/new.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=190478&r1=190477&r2=190478&view=diff
==============================================================================
--- libcxx/trunk/src/new.cpp (original)
+++ libcxx/trunk/src/new.cpp Tue Sep 10 20:38:42 2013
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+#define _LIBCPP_BUILDING_NEW
+
#include <stdlib.h>
#include "new"
@@ -187,12 +189,26 @@ bad_array_new_length::~bad_array_new_len
}
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()
More information about the cfe-commits
mailing list