Expose install_fatal_error_handler() through the C API.
[oota-llvm.git] / include / llvm-c / Core.h
index d39128db1a6d0322627d4ae123702dafcf69a8a9..f9717cc5f55121f1997fb8a3452b566e4560f1f4 100644 (file)
@@ -416,6 +416,22 @@ void LLVMShutdown();
 char *LLVMCreateMessage(const char *Message);
 void LLVMDisposeMessage(char *Message);
 
+typedef void (*LLVMFatalErrorHandler)(const char *Reason);
+
+/**
+ * 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).
+ */
+void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler);
+
+/**
+ * Reset the fatal error handler. This resets LLVM's fatal error handling
+ * behavior to the default.
+ */
+void LLVMResetFatalErrorHandler(void);
 
 /**
  * @defgroup LLVMCCoreContext Contexts