#include "wpi/Compiler.h"
#include <string>
#include <string_view>
Go to the source code of this file.
|
#define | wpi_unreachable(msg) ::wpi::wpi_unreachable_internal(msg, __FILE__, __LINE__) |
| Marks that the current location is not supposed to be reachable. More...
|
|
|
void | wpi::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 | wpi::remove_fatal_error_handler () |
| Restores default error handling behavior. More...
|
|
void | wpi::report_fatal_error (const char *reason, bool gen_crash_diag=true) |
| Reports a serious error, calling any installed error handler. More...
|
|
void | wpi::report_fatal_error (const std::string &reason, bool gen_crash_diag=true) |
|
void | wpi::report_fatal_error (std::string_view reason, bool gen_crash_diag=true) |
|
void | wpi::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 | wpi::remove_bad_alloc_error_handler () |
| Restores default bad alloc error handling behavior. More...
|
|
void | wpi::install_out_of_memory_new_handler () |
|
void | wpi::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 | wpi::wpi_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...
|
|
◆ wpi_unreachable
#define wpi_unreachable |
( |
|
msg | ) |
::wpi::wpi_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.