From 378122744886d5d6450839b30c7f4aadf4823a25 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 1 Mar 2017 23:59:34 +0000 Subject: Cleanup new/delete definitions This patch cleans up how libc++abi handles the definitions for new/delete. It is in preperation for upcoming changes to fix how both libc++ and libc++abi handle new/delete. The primary changes in this patch are: * Move the definitions for bad_array_length and bad_new_array_length into stdlib_exception.cpp. This way stdlib_new_delete.cpp only contains new/delete. * Rename cxa_new_delete.cpp -> stdlib_new_delete.cpp for consistency with other files. * Add a FIXME regarding when stdlib_new_delete.cpp is actually compiled as part of the dylib. llvm-svn: 296715 --- libcxxabi/src/stdlib_exception.cpp | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'libcxxabi/src/stdlib_exception.cpp') diff --git a/libcxxabi/src/stdlib_exception.cpp b/libcxxabi/src/stdlib_exception.cpp index fce6e8a7994..a8f71ab0ecc 100644 --- a/libcxxabi/src/stdlib_exception.cpp +++ b/libcxxabi/src/stdlib_exception.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +#define _LIBCPP_BUILDING_LIBRARY +#define _LIBCPP_BUILDING_NEW +#include #include namespace std @@ -34,4 +37,67 @@ const char* bad_exception::what() const _NOEXCEPT return "std::bad_exception"; } + +// bad_alloc + +bad_alloc::bad_alloc() _NOEXCEPT +{ +} + +bad_alloc::~bad_alloc() _NOEXCEPT +{ +} + +const char* +bad_alloc::what() const _NOEXCEPT +{ + return "std::bad_alloc"; +} + +// bad_array_new_length + +bad_array_new_length::bad_array_new_length() _NOEXCEPT +{ +} + +bad_array_new_length::~bad_array_new_length() _NOEXCEPT +{ +} + +const char* +bad_array_new_length::what() const _NOEXCEPT +{ + return "bad_array_new_length"; +} + +// bad_array_length + +#ifndef _LIBCPP_BAD_ARRAY_LENGTH_DEFINED + +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_BAD_ARRAY_LENGTH_DEFINED + +bad_array_length::bad_array_length() _NOEXCEPT +{ +} + +bad_array_length::~bad_array_length() _NOEXCEPT +{ +} + +const char* +bad_array_length::what() const _NOEXCEPT +{ + return "bad_array_length"; +} + + } // std -- cgit v1.2.3