LLVM  14.0.0git
Classes | Namespaces | Macros | Typedefs | Functions
ErrorHandling.h File Reference
#include "llvm/Support/Compiler.h"
Include dependency graph for ErrorHandling.h:

Go to the source code of this file.


struct  llvm::ScopedFatalErrorHandler
 ScopedFatalErrorHandler - This is a simple helper class which just calls install_fatal_error_handler in its constructor and remove_fatal_error_handler in its destructor. More...


 This is an optimization pass for GlobalISel generic memory operations.


#define llvm_unreachable(msg)   ::llvm::llvm_unreachable_internal(msg, __FILE__, __LINE__)
 Marks that the current location is not supposed to be reachable. More...


typedef void(* llvm::fatal_error_handler_t) (void *user_data, const char *reason, bool gen_crash_diag)
 An error handler callback. More...


void llvm::install_fatal_error_handler (fatal_error_handler_t handler, void *user_data=nullptr)
 install_fatal_error_handler - Installs a new error handler to be used whenever a serious (non-recoverable) error is encountered by LLVM. More...
void llvm::remove_fatal_error_handler ()
 Restores default error handling behaviour. More...
void llvm::report_fatal_error (const char *reason, bool gen_crash_diag=true)
 Reports a serious error, calling any installed error handler. More...
void llvm::report_fatal_error (StringRef reason, bool gen_crash_diag=true)
void llvm::report_fatal_error (const Twine &reason, bool gen_crash_diag=true)
void llvm::install_bad_alloc_error_handler (fatal_error_handler_t handler, void *user_data=nullptr)
 Installs a new bad alloc error handler that should be used whenever a bad alloc error, e.g. More...
void llvm::remove_bad_alloc_error_handler ()
 Restores default bad alloc error handling behavior. More...
void llvm::install_out_of_memory_new_handler ()
void llvm::report_bad_alloc_error (const char *Reason, bool GenCrashDiag=true)
 Reports a bad alloc error, calling any user defined bad alloc error handler. More...
void llvm::llvm_unreachable_internal (const char *msg=nullptr, const char *file=nullptr, unsigned line=0)
 This function calls abort(), and prints the optional message to stderr. More...

Macro Definition Documentation

◆ llvm_unreachable

#define llvm_unreachable (   msg)    ::llvm::llvm_unreachable_internal(msg, __FILE__, __LINE__)

Marks that the current location is not supposed to be reachable.

In !NDEBUG builds, prints the message and location info to stderr. In NDEBUG builds, becomes an optimizer hint that the current location is not supposed to be reachable. On compilers that don't support such hints, prints a reduced message instead and aborts the program.

Use this instead of assert(0). It conveys intent more clearly and allows compilers to omit some unnecessary code.

Definition at line 134 of file ErrorHandling.h.