| OLD | NEW |
| 1 //===--------------------------- new.cpp ----------------------------------===// | 1 //===--------------------------- new.cpp ----------------------------------===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is dual licensed under the MIT and the University of Illinois Open | 5 // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 // Source Licenses. See LICENSE.TXT for details. | 6 // Source Licenses. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 | 9 |
| 10 #define _LIBCPP_BUILDING_NEW | 10 #define _LIBCPP_BUILDING_NEW |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #endif | 24 #endif |
| 25 #else // __APPLE__ | 25 #else // __APPLE__ |
| 26 #if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI) | 26 #if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI) |
| 27 #include <cxxabi.h> | 27 #include <cxxabi.h> |
| 28 #endif // defined(LIBCXX_BUILDING_LIBCXXABI) | 28 #endif // defined(LIBCXX_BUILDING_LIBCXXABI) |
| 29 #if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__) | 29 #if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__) |
| 30 static std::new_handler __new_handler; | 30 static std::new_handler __new_handler; |
| 31 #endif // _LIBCPPABI_VERSION | 31 #endif // _LIBCPPABI_VERSION |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS |
| 35 void * |
| 36 operator new(std::size_t size, std::new_tag) |
| 37 #if !__has_feature(cxx_noexcept) |
| 38 throw(std::bad_alloc) |
| 39 #endif |
| 40 { |
| 41 return ::operator new(size); |
| 42 } |
| 43 |
| 34 #ifndef __GLIBCXX__ | 44 #ifndef __GLIBCXX__ |
| 35 | 45 |
| 36 // Implement all new and delete operators as weak definitions | 46 // Implement all new and delete operators as weak definitions |
| 37 // in this shared library, so that they can be overridden by programs | 47 // in this shared library, so that they can be overridden by programs |
| 38 // that define non-weak copies of the functions. | 48 // that define non-weak copies of the functions. |
| 39 | 49 |
| 40 _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS | 50 _LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS |
| 41 void * | 51 void * |
| 42 operator new(std::size_t size) | 52 operator new(std::size_t size) |
| 43 #if !__has_feature(cxx_noexcept) | 53 #if !__has_feature(cxx_noexcept) |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 __throw_bad_alloc() | 250 __throw_bad_alloc() |
| 241 { | 251 { |
| 242 #ifndef _LIBCPP_NO_EXCEPTIONS | 252 #ifndef _LIBCPP_NO_EXCEPTIONS |
| 243 throw bad_alloc(); | 253 throw bad_alloc(); |
| 244 #endif | 254 #endif |
| 245 } | 255 } |
| 246 | 256 |
| 247 #endif // !LIBSTDCXX | 257 #endif // !LIBSTDCXX |
| 248 | 258 |
| 249 } // std | 259 } // std |
| OLD | NEW |