| 1 | /*===-- llvm-c/IRReader.h - IR Reader 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 the IR Reader. *| |
| 11 | |* *| |
| 12 | \*===----------------------------------------------------------------------===*/ |
| 13 | |
| 14 | #ifndef LLVM_C_IRREADER_H |
| 15 | #define LLVM_C_IRREADER_H |
| 16 | |
| 17 | #include "llvm-c/ExternC.h" |
| 18 | #include "llvm-c/Types.h" |
| 19 | #include "llvm-c/Visibility.h" |
| 20 | |
| 21 | LLVM_C_EXTERN_C_BEGIN |
| 22 | |
| 23 | /** |
| 24 | * @defgroup LLVMCCoreIRReader IR Reader |
| 25 | * @ingroup LLVMCCore |
| 26 | * |
| 27 | * @{ |
| 28 | */ |
| 29 | |
| 30 | /** |
| 31 | * Read LLVM IR from a memory buffer and convert it into an in-memory Module |
| 32 | * object. Returns 0 on success. |
| 33 | * Optionally returns a human-readable description of any errors that |
| 34 | * occurred during parsing IR. OutMessage must be disposed with |
| 35 | * LLVMDisposeMessage. |
| 36 | * The memory buffer is consumed by this function. |
| 37 | * This is deprecated. Use LLVMParseIRInContext2 instead. |
| 38 | * |
| 39 | * @see llvm::ParseIR() |
| 40 | */ |
| 41 | LLVM_C_ABI LLVMBool LLVMParseIRInContext(LLVMContextRef ContextRef, |
| 42 | LLVMMemoryBufferRef MemBuf, |
| 43 | LLVMModuleRef *OutM, |
| 44 | char **OutMessage); |
| 45 | /** |
| 46 | * Read LLVM IR from a memory buffer and convert it into an in-memory Module |
| 47 | * object. Returns 0 on success. |
| 48 | * Optionally returns a human-readable description of any errors that |
| 49 | * occurred during parsing IR. OutMessage must be disposed with |
| 50 | * LLVMDisposeMessage. |
| 51 | * The memory buffer is not consumed by this function. It is the responsibility |
| 52 | * of the caller to free it with \c LLVMDisposeMemoryBuffer. |
| 53 | * |
| 54 | * @see llvm::ParseIR() |
| 55 | */ |
| 56 | LLVM_C_ABI LLVMBool LLVMParseIRInContext2(LLVMContextRef ContextRef, |
| 57 | LLVMMemoryBufferRef MemBuf, |
| 58 | LLVMModuleRef *OutM, |
| 59 | char **OutMessage); |
| 60 | |
| 61 | /** |
| 62 | * @} |
| 63 | */ |
| 64 | |
| 65 | LLVM_C_EXTERN_C_END |
| 66 | |
| 67 | #endif |
| 68 | |