LLVM  14.0.0git
ErrorHandling.h
Go to the documentation of this file.
1 /*===-- llvm-c/ErrorHandling.h - Error Handling C Interface -------*- C -*-===*\
2 |* *|
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
4 |* Exceptions. *|
5 |* See https://llvm.org/LICENSE.txt for license information. *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
7 |* *|
8 |*===----------------------------------------------------------------------===*|
9 |* *|
10 |* This file defines the C interface to LLVM's error handling mechanism. *|
11 |* *|
12 \*===----------------------------------------------------------------------===*/
13 
14 #ifndef LLVM_C_ERRORHANDLING_H
15 #define LLVM_C_ERRORHANDLING_H
16 
17 #include "llvm-c/ExternC.h"
18 
20 
21 /**
22  * @addtogroup LLVMCError
23  *
24  * @{
25  */
26 
27 typedef void (*LLVMFatalErrorHandler)(const char *Reason);
28 
29 /**
30  * Install a fatal error handler. By default, if LLVM detects a fatal error, it
31  * will call exit(1). This may not be appropriate in many contexts. For example,
32  * doing exit(1) will bypass many crash reporting/tracing system tools. This
33  * function allows you to install a callback that will be invoked prior to the
34  * call to exit(1).
35  */
37 
38 /**
39  * Reset the fatal error handler. This resets LLVM's fatal error handling
40  * behavior to the default.
41  */
43 
44 /**
45  * Enable LLVM's built-in stack trace code. This intercepts the OS's crash
46  * signals and prints which component of LLVM you were in at the time if the
47  * crash.
48  */
50 
51 /**
52  * @}
53  */
54 
56 
57 #endif
LLVMEnablePrettyStackTrace
void LLVMEnablePrettyStackTrace(void)
Enable LLVM's built-in stack trace code.
Definition: PrettyStackTrace.cpp:322
LLVMResetFatalErrorHandler
void LLVMResetFatalErrorHandler(void)
Reset the fatal error handler.
Definition: ErrorHandling.cpp:229
LLVMFatalErrorHandler
void(* LLVMFatalErrorHandler)(const char *Reason)
Definition: ErrorHandling.h:27
LLVM_C_EXTERN_C_END
#define LLVM_C_EXTERN_C_END
Definition: ExternC.h:36
LLVM_C_EXTERN_C_BEGIN
#define LLVM_C_EXTERN_C_BEGIN
Definition: ExternC.h:35
ExternC.h
LLVMInstallFatalErrorHandler
void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler)
Install a fatal error handler.
Definition: ErrorHandling.cpp:224