Path: blob/main/contrib/llvm-project/llvm/include/llvm-c/Error.h
35233 views
/*===------- llvm-c/Error.h - llvm::Error class C Interface -------*- C -*-===*\1|* *|2|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|3|* Exceptions. *|4|* See https://llvm.org/LICENSE.txt for license information. *|5|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|6|* *|7|*===----------------------------------------------------------------------===*|8|* *|9|* This file defines the C interface to LLVM's Error class. *|10|* *|11\*===----------------------------------------------------------------------===*/1213#ifndef LLVM_C_ERROR_H14#define LLVM_C_ERROR_H1516#include "llvm-c/ExternC.h"1718LLVM_C_EXTERN_C_BEGIN1920/**21* @defgroup LLVMCError Error Handling22* @ingroup LLVMC23*24* @{25*/2627#define LLVMErrorSuccess 02829/**30* Opaque reference to an error instance. Null serves as the 'success' value.31*/32typedef struct LLVMOpaqueError *LLVMErrorRef;3334/**35* Error type identifier.36*/37typedef const void *LLVMErrorTypeId;3839/**40* Returns the type id for the given error instance, which must be a failure41* value (i.e. non-null).42*/43LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err);4445/**46* Dispose of the given error without handling it. This operation consumes the47* error, and the given LLVMErrorRef value is not usable once this call returns.48* Note: This method *only* needs to be called if the error is not being passed49* to some other consuming operation, e.g. LLVMGetErrorMessage.50*/51void LLVMConsumeError(LLVMErrorRef Err);5253/**54* Returns the given string's error message. This operation consumes the error,55* and the given LLVMErrorRef value is not usable once this call returns.56* The caller is responsible for disposing of the string by calling57* LLVMDisposeErrorMessage.58*/59char *LLVMGetErrorMessage(LLVMErrorRef Err);6061/**62* Dispose of the given error message.63*/64void LLVMDisposeErrorMessage(char *ErrMsg);6566/**67* Returns the type id for llvm StringError.68*/69LLVMErrorTypeId LLVMGetStringErrorTypeId(void);7071/**72* Create a StringError.73*/74LLVMErrorRef LLVMCreateStringError(const char *ErrMsg);7576/**77* @}78*/7980LLVM_C_EXTERN_C_END8182#endif838485