Lang Hames | 00fb14d | 2018-08-15 18:42:11 +0000 | [diff] [blame] | 1 | /*===------- llvm-c/Error.h - llvm::Error class 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 class. *| |
| 11 | |* *| |
| 12 | \*===----------------------------------------------------------------------===*/ |
| 13 | |
| 14 | #ifndef LLVM_C_ERROR_H |
| 15 | #define LLVM_C_ERROR_H |
| 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | |
| 21 | /** |
| 22 | * Opaque reference to an error instance. Null serves as the 'success' value. |
| 23 | */ |
| 24 | typedef struct LLVMOpaqueError *LLVMErrorRef; |
| 25 | |
| 26 | /** |
| 27 | * Error type identifier. |
| 28 | */ |
| 29 | typedef const void *LLVMErrorTypeId; |
| 30 | |
| 31 | /** |
| 32 | * Returns the type id for the given error instance, which must be a failure |
| 33 | * value (i.e. non-null). |
| 34 | */ |
| 35 | LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err); |
| 36 | |
| 37 | /** |
| 38 | * Dispose of the given error without handling it. This operation consumes the |
| 39 | * error, and the given LLVMErrorRef value is not usable once this call returns. |
| 40 | * Note: This method *only* needs to be called if the error is not being passed |
| 41 | * to some other consuming operation, e.g. LLVMGetErrorMessage. |
| 42 | */ |
| 43 | void LLVMConsumeError(LLVMErrorRef Err); |
| 44 | |
| 45 | /** |
| 46 | * Returns the given string's error message. This operation consumes the error, |
| 47 | * and the given LLVMErrorRef value is not usable once this call returns. |
| 48 | */ |
| 49 | char *LLVMGetErrorMessage(LLVMErrorRef Err); |
| 50 | |
| 51 | /** |
| 52 | * Dispose of the given error message. |
| 53 | */ |
| 54 | void LLVMDisposeErrorMessage(char *ErrMsg); |
| 55 | |
| 56 | /** |
| 57 | * Returns the type id for llvm StringError. |
| 58 | */ |
| 59 | LLVMErrorTypeId LLVMGetStringErrorTypeId(); |
| 60 | |
| 61 | #ifdef __cplusplus |
| 62 | } |
| 63 | #endif |
| 64 | |
| 65 | #endif |