19 #include "llvm/Config/config.h" 32 #if defined(HAVE_UNISTD_H) 48 #if LLVM_ENABLE_THREADS == 1 66 #if LLVM_ENABLE_THREADS == 1 75 #if LLVM_ENABLE_THREADS == 1 96 void* handlerData =
nullptr;
100 #if LLVM_ENABLE_THREADS == 1 108 handler(handlerData, Reason.
str(), GenCrashDiag);
115 OS <<
"LLVM ERROR: " << Reason <<
"\n";
131 #if LLVM_ENABLE_THREADS == 1 140 #if LLVM_ENABLE_THREADS == 1 149 void *HandlerData =
nullptr;
153 #if LLVM_ENABLE_THREADS == 1 161 Handler(HandlerData, Reason, GenCrashDiag);
165 #ifdef LLVM_ENABLE_EXCEPTIONS 167 throw std::bad_alloc();
171 char OOMMessage[] =
"LLVM ERROR: out of memory\n";
172 ssize_t written =
::write(2, OOMMessage, strlen(OOMMessage));
178 #ifdef LLVM_ENABLE_EXCEPTIONS 194 static bool out_of_memory_new_handler_installed =
false;
195 if (!out_of_memory_new_handler_installed) {
197 out_of_memory_new_handler_installed =
true;
217 dbgs() << msg <<
"\n";
218 dbgs() <<
"UNREACHABLE executed";
220 dbgs() <<
" at " << file <<
":" << line;
223 #ifdef LLVM_BUILTIN_UNREACHABLE 226 LLVM_BUILTIN_UNREACHABLE;
231 bool gen_crash_diag) {
234 handler(reason.c_str());
248 #include <winerror.h> 251 #define MAP_ERR_TO_COND(x, y) \ 253 return make_error_code(errc::y) 258 MAP_ERR_TO_COND(ERROR_ALREADY_EXISTS,
file_exists);
264 MAP_ERR_TO_COND(ERROR_CANTOPEN,
io_error);
265 MAP_ERR_TO_COND(ERROR_CANTREAD,
io_error);
266 MAP_ERR_TO_COND(ERROR_CANTWRITE,
io_error);
287 MAP_ERR_TO_COND(ERROR_OPEN_FAILED,
io_error);
292 MAP_ERR_TO_COND(ERROR_READ_FAULT,
io_error);
294 MAP_ERR_TO_COND(ERROR_SEEK,
io_error);
297 MAP_ERR_TO_COND(ERROR_WRITE_FAULT,
io_error);
307 return std::error_code(EV, std::system_category());
void(* LLVMFatalErrorHandler)(const char *Reason)
*ViewGraph Emit a dot run run gv on the postscript file
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
static void bindingsErrorHandler(void *user_data, const std::string &reason, bool gen_crash_diag)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
A raw_ostream that writes to an SmallVector or SmallString.
void 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.
static class NewHandlerInstaller new_handler_installer
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
static void * ErrorHandlerUserData
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static fatal_error_handler_t ErrorHandler
void remove_fatal_error_handler()
Restores default error handling behaviour.
void(* fatal_error_handler_t)(void *user_data, const std::string &reason, bool gen_crash_diag)
An error handler callback.
void remove_bad_alloc_error_handler()
Restores default bad alloc error handling behavior.
static void * BadAllocErrorHandlerUserData
#define LLVM_EXTENSION
LLVM_EXTENSION - Support compilers where we have a keyword to suppress pedantic diagnostics.
void RunInterruptHandlers()
This function runs all the registered interrupt handlers, including the removal of files registered b...
std::error_code mapWindowsError(unsigned EV)
static std::mutex BadAllocErrorHandlerMutex
static void write(bool isBE, void *P, T V)
static void out_of_memory_new_handler()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void report_bad_alloc_error(const char *Reason, bool GenCrashDiag=true)
Reports a bad alloc error, calling any user defined bad alloc error handler.
void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler)
Install a fatal error handler.
static fatal_error_handler_t BadAllocErrorHandler
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
StringRef str()
Return a StringRef for the vector contents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ATTRIBUTE_NORETURN void 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.
void LLVMResetFatalErrorHandler()
Reset the fatal error handler.
static std::mutex ErrorHandlerMutex
std::string str() const
Return the twine contents as a std::string.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
void install_out_of_memory_new_handler()
void 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-recover...