LLVM 22.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#include "llvm-c/Visibility.h"
19
21
22/**
23 * @addtogroup LLVMCError
24 *
25 * @{
26 */
27
28typedef void (*LLVMFatalErrorHandler)(const char *Reason);
29
30/**
31 * Install a fatal error handler. By default, if LLVM detects a fatal error, it
32 * will call exit(1). This may not be appropriate in many contexts. For example,
33 * doing exit(1) will bypass many crash reporting/tracing system tools. This
34 * function allows you to install a callback that will be invoked prior to the
35 * call to exit(1).
36 */
38
39/**
40 * Reset the fatal error handler. This resets LLVM's fatal error handling
41 * behavior to the default.
42 */
44
45/**
46 * Enable LLVM's built-in stack trace code. This intercepts the OS's crash
47 * signals and prints which component of LLVM you were in at the time if the
48 * crash.
49 */
51
52/**
53 * @}
54 */
55
57
58#endif
#define LLVM_C_EXTERN_C_BEGIN
Definition ExternC.h:35
#define LLVM_C_EXTERN_C_END
Definition ExternC.h:36
#define LLVM_C_ABI
LLVM_C_ABI is the export/visibility macro used to mark symbols declared in llvm-c as exported when bu...
Definition Visibility.h:40
LLVM_C_ABI void LLVMEnablePrettyStackTrace(void)
Enable LLVM's built-in stack trace code.
LLVM_C_ABI void LLVMResetFatalErrorHandler(void)
Reset the fatal error handler.
void(* LLVMFatalErrorHandler)(const char *Reason)
LLVM_C_ABI void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler)
Install a fatal error handler.