diff options
author | Eric Fiselier <eric@efcs.ca> | 2017-03-01 23:59:34 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2017-03-01 23:59:34 +0000 |
commit | 477fd7ee6e0debe1f9a32d9ec8a37d2f3d0ae635 (patch) | |
tree | 64a7d45366139e7a884c8f6f5cf73bec5ed6ef36 /src/stdlib_exception.cpp | |
parent | 2ecb4ee2222ad37b0d4da0812fa09edd3834a5d3 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@296715 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/stdlib_exception.cpp')
-rw-r--r-- | src/stdlib_exception.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/stdlib_exception.cpp b/src/stdlib_exception.cpp index fce6e8a..a8f71ab 100644 --- a/src/stdlib_exception.cpp +++ b/src/stdlib_exception.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +#define _LIBCPP_BUILDING_LIBRARY +#define _LIBCPP_BUILDING_NEW +#include <new> #include <exception> 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 |