This is an archive of the discontinued LLVM Phabricator instance.

Add a new routine to libc++abi to get the number of uncaught exceptions
ClosedPublic

Authored by mclow.lists on May 27 2015, 11:25 AM.

Details

Summary

In http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4259, the method std::uncaught_exceptions() (note the 's') on the end was added to the C++ working paper. This returns the number of currently uncaught exceptions.

The old routine uncaught_exception was deprecated.
libc++abi knows the number, but the call __cxa_uncaught_exception just returns if it is != 0.

Add a new call __cxa_uncaught_exceptions, (with an 's') and make __cxa_uncaught_exception call it.

After this is landed, there will need to be changes to libc++ to use it.

Diff Detail

Event Timeline

mclow.lists retitled this revision from to Add a new routine to libc++abi to get the number of uncaught exceptions.
mclow.lists updated this object.
mclow.lists edited the test plan for this revision. (Show Details)
mclow.lists added reviewers: EricWF, jroelofs.
mclow.lists added a subscriber: Unknown Object (MLST).
jroelofs edited edge metadata.May 28 2015, 7:35 AM

Seems reasonable to me. Mind writing testcases for both functions?

include/cxxabi.h
164

s/addition/extension/ while you're here?

jroelofs accepted this revision.May 28 2015, 7:35 AM
jroelofs edited edge metadata.
This revision is now accepted and ready to land.May 28 2015, 7:35 AM
EricWF edited edge metadata.May 28 2015, 9:18 AM

I think that this patch should bump the value of _LIBCPPAPI_VERSION. libc++ is going to need to know when libc++abi supports __cxa_uncaught_exceptions() and when it doesn't in order to provide std::uncaught_exceptions(). Using the value of _LIBCPPABI_VERSION seems like an appropriate approach.

Other than that and @jroelofs request for tests this patch LGTM.

mclow.lists edited edge metadata.

Added basic tests.
Bumped the version # for libc++abi

cool... LGTM.

test/uncaught_exceptions.pass.cpp
1 ↗(On Diff #26834)

catch_ptr_02.cpp --> uncaught_exceptions.pass.cpp

mclow.lists closed this revision.Jun 2 2015, 6:08 AM

Committed as r238827.