diff options
author | Eric Fiselier <eric@efcs.ca> | 2017-02-10 08:57:35 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2017-02-10 08:57:35 +0000 |
commit | d22c9dc4222bb875be4efb496396b8b449a09e57 (patch) | |
tree | 611813b10b6d06f96d472103dcb4c277eeda9ade /libcxx/include/new | |
parent | 7bc6028d7d53351f7131e7d4f2f9bfc2ee2679b7 (diff) | |
download | bcm5719-llvm-d22c9dc4222bb875be4efb496396b8b449a09e57.tar.gz bcm5719-llvm-d22c9dc4222bb875be4efb496396b8b449a09e57.zip |
Recommit "Split exception.cpp and new.cpp implementation into different files for different runtimes."
This recommits r294707 with additional fixes. The main difference is
libc++ now correctly builds without any ABI library.
exception.cpp is a bloody mess. It's full of confusing #ifdef branches for
each different ABI library we support, and it's getting unmaintainable.
This patch breaks down exception.cpp into multiple different header files,
roughly one per implementation. Additionally it moves the definitions of
exceptions in new.cpp into the correct implementation header.
This patch also removes an unmaintained libc++abi configuration.
This configuration may still be used by Apple internally but there
are no other possible users. If it turns out that Apple still uses
this configuration internally I will re-add it in a later commit.
See http://llvm.org/PR31904.
llvm-svn: 294730
Diffstat (limited to 'libcxx/include/new')
-rw-r--r-- | libcxx/include/new | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/libcxx/include/new b/libcxx/include/new index 86428f281dc..c0e7b2dafe5 100644 --- a/libcxx/include/new +++ b/libcxx/include/new @@ -92,6 +92,10 @@ void operator delete[](void* ptr, void*) noexcept; #include <cstdlib> #endif +#if defined(_LIBCPP_ABI_MICROSOFT) +#include <new.h> +#endif + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif @@ -110,6 +114,10 @@ void operator delete[](void* ptr, void*) noexcept; namespace std // purposefully not using versioning namespace { +#if !defined(_LIBCPP_ABI_MICROSOFT) +struct _LIBCPP_TYPE_VIS nothrow_t {}; +extern _LIBCPP_FUNC_VIS const nothrow_t nothrow; + class _LIBCPP_EXCEPTION_ABI bad_alloc : public exception { @@ -128,9 +136,15 @@ public: virtual const char* what() const _NOEXCEPT; }; +typedef void (*new_handler)(); +_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT; +_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT; + +#endif // !_LIBCPP_ABI_MICROSOFT + _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec -#if defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11) +#if defined(_LIBCPP_BUILDING_LIBRARY) || (_LIBCPP_STD_VER > 11) class _LIBCPP_EXCEPTION_ABI bad_array_length : public bad_alloc @@ -153,12 +167,6 @@ enum align_val_t { __zero = 0, __max = (size_t)-1 }; #endif #endif -struct _LIBCPP_TYPE_VIS nothrow_t {}; -extern _LIBCPP_FUNC_VIS const nothrow_t nothrow; -typedef void (*new_handler)(); -_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT; -_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT; - } // std #if defined(_LIBCPP_CXX03_LANG) @@ -167,6 +175,8 @@ _LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT; #define _THROW_BAD_ALLOC #endif +#if !defined(_LIBCPP_ABI_MICROSOFT) + _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC; _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT; @@ -206,6 +216,8 @@ inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _N inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {} inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {} +#endif // !_LIBCPP_ABI_MICROSOFT + _LIBCPP_BEGIN_NAMESPACE_STD inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) { |