Report a bad allocation error via the installed handler.

Synopsis

Declared in <llvm/Support/ErrorHandling.h>

[[noreturn]]
void
report_bad_alloc_error(
    char const* Reason,
    bool GenCrashDiag = true);

Description

Calls any user‐defined bad alloc error handler. In contrast to the generic 'report_fatal_error' functions, this function might not terminate, e.g. the user defined error handler throws an exception, but it won't return.

Note: When throwing an exception in the bad alloc handler, make sure that the following unwind succeeds, e.g. do not trigger additional allocations in the unwind chain.

If no error handler is installed (default), throws a bad_alloc exception if LLVM is compiled with exception support. Otherwise prints the error to standard error and calls abort().

Return Value

Note

This function does not return.

Parameters

Name

Description

Reason

Message describing the allocation failure.

GenCrashDiag

Whether to generate a crash diagnostic.

Created with MrDocs