1/*===-- llvm-c/ErrorHandling.h - Error Handling C Interface -------*- C -*-===*\
2|*                                                                            *|
3|*                     The LLVM Compiler Infrastructure                       *|
4|*                                                                            *|
5|* This file is distributed under the University of Illinois Open Source      *|
6|* License. See LICENSE.TXT for details.                                      *|
7|*                                                                            *|
8|*===----------------------------------------------------------------------===*|
9|*                                                                            *|
10|* This file defines the C interface to LLVM's error handling mechanism.      *|
11|*                                                                            *|
12\*===----------------------------------------------------------------------===*/
13
14#ifndef LLVM_C_ERROR_HANDLING_H
15#define LLVM_C_ERROR_HANDLING_H
16
17#include "llvm-c/Types.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23typedef void (*LLVMFatalErrorHandler)(const char *Reason);
24
25/**
26 * Install a fatal error handler. By default, if LLVM detects a fatal error, it
27 * will call exit(1). This may not be appropriate in many contexts. For example,
28 * doing exit(1) will bypass many crash reporting/tracing system tools. This
29 * function allows you to install a callback that will be invoked prior to the
30 * call to exit(1).
31 */
32void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler);
33
34/**
35 * Reset the fatal error handler. This resets LLVM's fatal error handling
36 * behavior to the default.
37 */
38void LLVMResetFatalErrorHandler(void);
39
40/**
41 * Enable LLVM's built-in stack trace code. This intercepts the OS's crash
42 * signals and prints which component of LLVM you were in at the time if the
43 * crash.
44 */
45void LLVMEnablePrettyStackTrace(void);
46
47#ifdef __cplusplus
48}
49#endif
50
51#endif
52