ΒΆvoid install_bad_alloc_error_handler(
    llvm::fatal_error_handler_t handler,
    void* user_data = nullptr)

Description

Installs a new bad alloc error handler that should be used whenever a bad alloc error, e.g. failing malloc/calloc, is encountered by LLVM. The user can install a bad alloc handler, in order to define the behavior in case of failing allocations, e.g. throwing an exception. Note that this handler must not trigger any additional allocations itself. If no error handler is installed the default is to print the error message to stderr, and call exit(1). If an error handler is installed then it is the handler's responsibility to log the message, it will no longer be printed to stderr. If the error handler returns, then exit(1) will be called.

Declared at: llvm/include/llvm/Support/ErrorHandling.h:96

Parameters

llvm::fatal_error_handler_t handler
void* user_data = nullptr
- An argument which will be passed to the installed error handler.