1 /*===------- llvm-c/Error.h - llvm::Error class C Interface -------*- C -*-===*\
3 |* The LLVM Compiler Infrastructure *|
5 |* This file is distributed under the University of Illinois Open Source *|
6 |* License. See LICENSE.TXT for details. *|
8 |*===----------------------------------------------------------------------===*|
10 |* This file defines the C interface to LLVM's Error class. *|
12 \*===----------------------------------------------------------------------===*/
14 #ifndef LLVM_C_ERROR_H
15 #define LLVM_C_ERROR_H
21 #define LLVMErrorSuccess 0
24 * Opaque reference to an error instance. Null serves as the 'success' value.
26 typedef struct LLVMOpaqueError *LLVMErrorRef;
29 * Error type identifier.
31 typedef const void *LLVMErrorTypeId;
34 * Returns the type id for the given error instance, which must be a failure
35 * value (i.e. non-null).
37 LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err);
40 * Dispose of the given error without handling it. This operation consumes the
41 * error, and the given LLVMErrorRef value is not usable once this call returns.
42 * Note: This method *only* needs to be called if the error is not being passed
43 * to some other consuming operation, e.g. LLVMGetErrorMessage.
45 void LLVMConsumeError(LLVMErrorRef Err);
48 * Returns the given string's error message. This operation consumes the error,
49 * and the given LLVMErrorRef value is not usable once this call returns.
50 * The caller is responsible for disposing of the string by calling
51 * LLVMDisposeErrorMessage.
53 char *LLVMGetErrorMessage(LLVMErrorRef Err);
56 * Dispose of the given error message.
58 void LLVMDisposeErrorMessage(char *ErrMsg);
61 * Returns the type id for llvm StringError.
63 LLVMErrorTypeId LLVMGetStringErrorTypeId();