LLVM  14.0.0git
Functions | Variables
ErrorHandling.cpp File Reference
#include "llvm/Support/ErrorHandling.h"
#include "llvm-c/ErrorHandling.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Config/config.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/Threading.h"
#include "llvm/Support/WindowsError.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstdlib>
#include <mutex>
#include <new>
#include <unistd.h>
Include dependency graph for ErrorHandling.cpp:

Go to the source code of this file.


static void out_of_memory_new_handler ()
static void bindingsErrorHandler (void *user_data, const char *reason, bool gen_crash_diag)
void LLVMInstallFatalErrorHandler (LLVMFatalErrorHandler Handler)
 Install a fatal error handler. More...
void LLVMResetFatalErrorHandler ()
 Reset the fatal error handler. More...


static fatal_error_handler_t ErrorHandler = nullptr
static void * ErrorHandlerUserData = nullptr
static fatal_error_handler_t BadAllocErrorHandler = nullptr
static void * BadAllocErrorHandlerUserData = nullptr
static std::mutex ErrorHandlerMutex
static std::mutex BadAllocErrorHandlerMutex

Function Documentation

◆ bindingsErrorHandler()

static void bindingsErrorHandler ( void *  user_data,
const char *  reason,
bool  gen_crash_diag 

Definition at line 217 of file ErrorHandling.cpp.

References LLVM_EXTENSION, and LLVMFatalErrorHandler.

Referenced by LLVMInstallFatalErrorHandler().

◆ LLVMInstallFatalErrorHandler()

void LLVMInstallFatalErrorHandler ( LLVMFatalErrorHandler  Handler)

Install a fatal error handler.

By default, if LLVM detects a fatal error, it will call exit(1). This may not be appropriate in many contexts. For example, doing exit(1) will bypass many crash reporting/tracing system tools. This function allows you to install a callback that will be invoked prior to the call to exit(1).

Definition at line 224 of file ErrorHandling.cpp.

References bindingsErrorHandler(), llvm::install_fatal_error_handler(), and LLVM_EXTENSION.

◆ LLVMResetFatalErrorHandler()

void LLVMResetFatalErrorHandler ( void  )

Reset the fatal error handler.

This resets LLVM's fatal error handling behavior to the default.

Definition at line 229 of file ErrorHandling.cpp.

References llvm::remove_fatal_error_handler().

◆ out_of_memory_new_handler()

static void out_of_memory_new_handler ( )

Variable Documentation

◆ BadAllocErrorHandler

fatal_error_handler_t BadAllocErrorHandler = nullptr

◆ BadAllocErrorHandlerMutex

std::mutex BadAllocErrorHandlerMutex

◆ BadAllocErrorHandlerUserData

void* BadAllocErrorHandlerUserData = nullptr

◆ ErrorHandler

fatal_error_handler_t ErrorHandler = nullptr

◆ ErrorHandlerMutex

std::mutex ErrorHandlerMutex

◆ ErrorHandlerUserData

void* ErrorHandlerUserData = nullptr