xref: /openbsd-src/gnu/llvm/libcxx/src/support/runtime/exception_libcxxabi.ipp (revision 76d0caaeb19ae0808d90af1d0b3b7b50b3e5383f)
146035553Spatrick// -*- C++ -*-
246035553Spatrick//===----------------------------------------------------------------------===//
346035553Spatrick//
446035553Spatrick// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
546035553Spatrick// See https://llvm.org/LICENSE.txt for license information.
646035553Spatrick// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
746035553Spatrick//
846035553Spatrick//===----------------------------------------------------------------------===//
946035553Spatrick
1046035553Spatrick#ifndef _LIBCPPABI_VERSION
1146035553Spatrick#error this header can only be used with libc++abi
1246035553Spatrick#endif
1346035553Spatrick
1446035553Spatricknamespace std {
1546035553Spatrick
16*76d0caaeSpatrickbool uncaught_exception() noexcept { return uncaught_exceptions() > 0; }
1746035553Spatrick
18*76d0caaeSpatrickint uncaught_exceptions() noexcept
1946035553Spatrick{
2046035553Spatrick# if _LIBCPPABI_VERSION > 1001
2146035553Spatrick    return __cxa_uncaught_exceptions();
2246035553Spatrick# else
2346035553Spatrick    return __cxa_uncaught_exception() ? 1 : 0;
2446035553Spatrick# endif
2546035553Spatrick}
2646035553Spatrick
2746035553Spatrick} // namespace std
28