Lines Matching full:exception
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 // This file implements the "Exception Handling APIs"
15 #include <exception> // for std::terminate
58 // Get the exception object from the unwind pointer.
60 // front of the user's exception object
115 static inline int incrementHandlerCount(__cxa_exception *exception) { in incrementHandlerCount() argument
116 return ++exception->handlerCount; in incrementHandlerCount()
120 static inline int decrementHandlerCount(__cxa_exception *exception) { in decrementHandlerCount() argument
121 return --exception->handlerCount; in decrementHandlerCount()
127 exc is called, and then the memory for the exception is deallocated.
138 // Just in case there exists a dependent exception that is pointing to this, in exception_cleanup_func()
145 // * For purposes of this ABI, several things are considered exception handlers: in failed_throw()
179 // Reserve "thrown_size" bytes on the end for the user's exception
182 // user's exception object.
242 // It does not affect the reference count of the primary exception. in __cxa_init_primary_exception()
248 // 2.4.3 Throwing the Exception Object in __cxa_init_primary_exception()
250 After constructing the exception object with the throw argument value, in __cxa_init_primary_exception()
256 * Obtain the __cxa_exception header from the thrown exception object address, in __cxa_init_primary_exception()
267 pointer to the thrown exception, which __cxa_throw itself received as an argument. in __cxa_init_primary_exception()
272 exception. in __cxa_init_primary_exception()
285 …exception_header->referenceCount = 1; // This is a newly allocated exception, no need for thread s… in __cxa_init_primary_exception()
303 // 2.5.3 Exception Handlers in __cxa_init_primary_exception()
306 and saved in the exception header (either __cxa_exception or in __cxa_init_primary_exception()
309 Requires: exception is native in __cxa_init_primary_exception()
344 // chain the foreign exception, terminate it. in __cxa_init_primary_exception()
419 This routine can catch foreign or native exceptions. If native, the exception in __cxa_init_primary_exception()
421 ignorant of whether the native exception is primary or dependent. in __cxa_init_primary_exception()
423 If the exception is native: in __cxa_init_primary_exception()
424 * Increment's the exception's handler count. in __cxa_init_primary_exception()
425 * Push the exception on the stack of currently-caught exceptions if it is not in __cxa_init_primary_exception()
428 * Returns the adjusted pointer to the exception object, which is stored in in __cxa_init_primary_exception()
431 If the exception is foreign, this means it did not originate from one of throw in __cxa_init_primary_exception()
432 routines. The foreign exception does not necessarily have a __cxa_exception in __cxa_init_primary_exception()
435 * Do not try to increment the exception's handler count, we don't know where in __cxa_init_primary_exception()
437 * Push the exception on the stack of currently-caught exceptions only if the in __cxa_init_primary_exception()
438 stack is empty. The foreign exception has no way to link to the current in __cxa_init_primary_exception()
441 __cxa_exception block in front of the foreign exception. It would be better in __cxa_init_primary_exception()
446 * If we haven't terminated, assume the exception object is just past the in __cxa_init_primary_exception()
455 // exception_header is a hackish offset from a foreign exception, but it in __cxa_init_primary_exception()
465 // Remove the exception object from the linked list of exceptions that the z/OS unwinder in __cxa_init_primary_exception()
467 // The libc++abi will manage the lifetime of the exception from this point forward. in __cxa_init_primary_exception()
476 // place the exception on the top of the stack if it's not already in __cxa_init_primary_exception()
490 // Else this is a foreign exception in __cxa_init_primary_exception()
494 // Push the foreign exception on to the stack in __cxa_init_primary_exception()
504 This routine can be called for either a native or foreign exception. in __cxa_init_primary_exception()
505 For a native exception: in __cxa_init_primary_exception()
506 * Locates the most recently caught exception and decrements its handler count. in __cxa_init_primary_exception()
507 * Removes the exception from the caught exception stack, if the handler count goes to zero. in __cxa_init_primary_exception()
508 * If the handler count goes down to zero, and the exception was not re-thrown in __cxa_init_primary_exception()
509 by throw, it locates the primary exception (which may be the same as the one in __cxa_init_primary_exception()
511 goes to zero, the function destroys the exception. In any case, if the current in __cxa_init_primary_exception()
512 exception is a dependent exception, it destroys that. in __cxa_init_primary_exception()
514 For a foreign exception: in __cxa_init_primary_exception()
516 * Otherwise delete the exception and pop the catch stack to empty. in __cxa_init_primary_exception()
533 // If we've rethrown a foreign exception, then globals->caughtExceptions in __cxa_init_primary_exception()
541 // This is a native exception in __cxa_init_primary_exception()
544 // The exception has been rethrown by __cxa_rethrow, so don't delete it in __cxa_init_primary_exception()
552 // that need to be told that this exception is rethrown. Don't in __cxa_init_primary_exception()
553 // erase this rethrow flag until the exception is recaught. in __cxa_init_primary_exception()
557 // The native exception has not been rethrown in __cxa_init_primary_exception()
562 // Destroy this exception, being careful to distinguish in __cxa_init_primary_exception()
566 … // Reset exception_header to primaryException and deallocate the dependent exception in __cxa_init_primary_exception()
573 // Destroy the primary exception only if its referenceCount goes to 0 in __cxa_init_primary_exception()
581 // The foreign exception has not been rethrown. Pop the stack in __cxa_init_primary_exception()
583 // to touch a foreign exception in any way, that is undefined in __cxa_init_primary_exception()
585 // a foreign exception is with catch (...)! in __cxa_init_primary_exception()
601 // get the current exception in __cxa_init_primary_exception()
607 return NULL; // No current exception in __cxa_init_primary_exception()
615 If the exception is native: in __cxa_init_primary_exception()
616 * marks the exception object on top of the caughtExceptions stack in __cxa_init_primary_exception()
629 std::terminate(); // throw; called outside of a exception handler in __cxa_init_primary_exception()
633 // Mark the exception as being rethrown (reverse the effects of __cxa_begin_catch) in __cxa_init_primary_exception()
636 // __cxa_end_catch will remove this exception from the caughtExceptions stack if necessary in __cxa_init_primary_exception()
638 else // this is a foreign exception in __cxa_init_primary_exception()
641 // a foreign exception, so don't delete us, is to pop the stack here in __cxa_init_primary_exception()
659 // Foreign exception: can't get exception_header->terminateHandler in __cxa_init_primary_exception()
668 Requires: If thrown_object is not NULL, it is a native exception. in __cxa_init_primary_exception()
683 deallocate the exception. in __cxa_init_primary_exception()
685 Requires: If thrown_object is not NULL, it is a native exception. in __cxa_init_primary_exception()
703 caughtExceptions stack. Atomically increment the exception's referenceCount. in __cxa_init_primary_exception()
709 the need to allocate the exception-handling globals. in __cxa_init_primary_exception()
712 // get the current exception in __cxa_init_primary_exception()
715 return NULL; // If there are no globals, there is no exception in __cxa_init_primary_exception()
718 return NULL; // No current exception in __cxa_init_primary_exception()
720 return NULL; // Can't capture a foreign exception (no way to refcount it) in __cxa_init_primary_exception()
734 primary exception is decremented, destroying the primary if necessary. in __cxa_init_primary_exception()
735 Finally the dependent exception is destroyed. in __cxa_init_primary_exception()
751 exception. in __cxa_init_primary_exception()