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