xref: /llvm-project/libc/src/stdlib/exit.cpp (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
1d6698386SAlex Brachet //===-- Implementation of exit --------------------------------------------===//
2d6698386SAlex Brachet //
3d6698386SAlex Brachet // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4d6698386SAlex Brachet // See https://llvm.org/LICENSE.txt for license information.
5d6698386SAlex Brachet // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6d6698386SAlex Brachet //
7d6698386SAlex Brachet //===----------------------------------------------------------------------===//
8d6698386SAlex Brachet 
9d6698386SAlex Brachet #include "src/stdlib/exit.h"
1007bd4394SRoseZhang03 #include "src/__support/OSUtil/exit.h"
11d6698386SAlex Brachet #include "src/__support/common.h"
12*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
13d6698386SAlex Brachet 
14*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
15d6698386SAlex Brachet 
16be9b1de1SPetr Hosek extern "C" void __cxa_finalize(void *);
17be9b1de1SPetr Hosek 
18ecfffbfdSNick Desaulniers [[noreturn]] LLVM_LIBC_FUNCTION(void, exit, (int status)) {
194318f7e5SNick Desaulniers   __cxa_finalize(nullptr);
2007bd4394SRoseZhang03   internal::exit(status);
21d6698386SAlex Brachet }
22d6698386SAlex Brachet 
23*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
24