10b57cec5SDimitry Andric// -*- C++ -*- 20b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 30b57cec5SDimitry Andric// 40b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 50b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 60b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 70b57cec5SDimitry Andric// 80b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 90b57cec5SDimitry Andric 100b57cec5SDimitry Andric#ifndef _LIBCPPABI_VERSION 110b57cec5SDimitry Andric# error this header can only be used with libc++abi 120b57cec5SDimitry Andric#endif 130b57cec5SDimitry Andric 140b57cec5SDimitry Andricnamespace std { 150b57cec5SDimitry Andric 16fe6060f1SDimitry Andricbool uncaught_exception() noexcept { return uncaught_exceptions() > 0; } 170b57cec5SDimitry Andric 18*cb14a3feSDimitry Andricint uncaught_exceptions() noexcept { 190b57cec5SDimitry Andric#if _LIBCPPABI_VERSION > 1001 200b57cec5SDimitry Andric return __cxa_uncaught_exceptions(); 210b57cec5SDimitry Andric#else 220b57cec5SDimitry Andric return __cxa_uncaught_exception() ? 1 : 0; 230b57cec5SDimitry Andric#endif 240b57cec5SDimitry Andric} 250b57cec5SDimitry Andric 260b57cec5SDimitry Andric} // namespace std 27