Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions system/lib/libcxxabi/src/cxa_noexception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ void *__cxa_allocate_exception(size_t thrown_size) _NOEXCEPT {
char* allocation = (char*)malloc(thrown_size + sizeof(__cxa_exception));
return allocation + sizeof(__cxa_exception);
}

static
inline
__cxa_exception*
cxa_exception_from_thrown_object(void* thrown_object)
{
return static_cast<__cxa_exception*>(thrown_object) - 1;
}

// Free a __cxa_exception object allocated with __cxa_allocate_exception.
void __cxa_free_exception(void *thrown_object) _NOEXCEPT {
// Compute the size of the padding before the header.
char *raw_buffer =
((char *)cxa_exception_from_thrown_object(thrown_object));
free((void *)raw_buffer);
}
#endif

} // extern "C"
Expand Down