xref: /freebsd/contrib/llvm-project/libcxx/src/new_helpers.cpp (revision 02e9120893770924227138ba49df1edb3896112a)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include <cstdlib>
10 #include <new>
11 
12 namespace std { // purposefully not versioned
13 
14 #ifndef __GLIBCXX__
15 const nothrow_t nothrow{};
16 #endif
17 
18 #ifndef LIBSTDCXX
19 
20 void __throw_bad_alloc() {
21 #  ifndef _LIBCPP_HAS_NO_EXCEPTIONS
22   throw bad_alloc();
23 #  else
24   std::abort();
25 #  endif
26 }
27 
28 #endif // !LIBSTDCXX
29 
30 } // namespace std
31