xref: /aosp_15_r20/external/libcxx/src/support/runtime/exception_libcxxabi.ipp (revision 58b9f456b02922dfdb1fad8a988d5fd8765ecb80)
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4//                     The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPPABI_VERSION
12#error this header can only be used with libc++abi
13#endif
14
15namespace std {
16
17bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
18
19int uncaught_exceptions() _NOEXCEPT
20{
21# if _LIBCPPABI_VERSION > 1001
22    return __cxa_uncaught_exceptions();
23# else
24    return __cxa_uncaught_exception() ? 1 : 0;
25# endif
26}
27
28} // namespace std
29