summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2015-06-02 15:33:38 +0000
committerMarshall Clow <mclow.lists@gmail.com>2015-06-02 15:33:38 +0000
commit89102f0fa96c1d3b53bf289802167fa78baaa83d (patch)
tree4def1737c86f0993c7cebf597e0b6cc9e53eacf8 /libcxx/src
parent1feab0f95ea0202f95a555a86f5dd60db4a8a5c8 (diff)
downloadbcm5719-llvm-89102f0fa96c1d3b53bf289802167fa78baaa83d.tar.gz
bcm5719-llvm-89102f0fa96c1d3b53bf289802167fa78baaa83d.zip
Implement uncaught_exceptions() using the newly added hooks in libc++abi, when available
llvm-svn: 238846
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/exception.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/libcxx/src/exception.cpp b/libcxx/src/exception.cpp
index 98b7b441b52..a13a0b9b064 100644
--- a/libcxx/src/exception.cpp
+++ b/libcxx/src/exception.cpp
@@ -105,19 +105,25 @@ terminate() _NOEXCEPT
#endif // !__EMSCRIPTEN__
#endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
+bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
+
#if !defined(LIBCXXRT) && !defined(__GLIBCXX__) && !defined(__EMSCRIPTEN__)
-bool uncaught_exception() _NOEXCEPT
+int uncaught_exceptions() _NOEXCEPT
{
#if defined(__APPLE__) || defined(_LIBCPPABI_VERSION)
- // on Darwin, there is a helper function so __cxa_get_globals is private
- return __cxa_uncaught_exception();
+ // on Darwin, there is a helper function so __cxa_get_globals is private
+# if _LIBCPPABI_VERSION > 1101
+ return __cxa_uncaught_exceptions();
+# else
+ return __cxa_uncaught_exception() ? 1 : 0;
+# endif
#else // __APPLE__
# if defined(_MSC_VER) && ! defined(__clang__)
- _LIBCPP_WARNING("uncaught_exception not yet implemented")
+ _LIBCPP_WARNING("uncaught_exceptions not yet implemented")
# else
# warning uncaught_exception not yet implemented
# endif
- fprintf(stderr, "uncaught_exception not yet implemented\n");
+ fprintf(stderr, "uncaught_exceptions not yet implemented\n");
::abort();
#endif // __APPLE__
}
OpenPOWER on IntegriCloud