1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10namespace std {
11
12static constinit std::new_handler __new_handler = nullptr;
13
14new_handler
15set_new_handler(new_handler handler) noexcept
16{
17    return __libcpp_atomic_exchange(&__new_handler, handler);
18}
19
20new_handler
21get_new_handler() noexcept
22{
23    return __libcpp_atomic_load(&__new_handler);
24}
25
26} // namespace std
27