| 1 | /*===-- llvm-c/BitReader.h - BitReader Library 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 header declares the C interface to libLLVMBitReader.a, which *| |
| 11 | |* implements input of the LLVM bitcode format. *| |
| 12 | |* *| |
| 13 | |* Many exotic languages can interoperate with C code but have a harder time *| |
| 14 | |* with C++ due to name mangling. So in addition to C, this interface enables *| |
| 15 | |* tools written in such languages. *| |
| 16 | |* *| |
| 17 | \*===----------------------------------------------------------------------===*/ |
| 18 | |
| 19 | #ifndef LLVM_C_BITREADER_H |
| 20 | #define LLVM_C_BITREADER_H |
| 21 | |
| 22 | #include "llvm-c/Deprecated.h" |
| 23 | #include "llvm-c/ExternC.h" |
| 24 | #include "llvm-c/Types.h" |
| 25 | #include "llvm-c/Visibility.h" |
| 26 | |
| 27 | LLVM_C_EXTERN_C_BEGIN |
| 28 | |
| 29 | /** |
| 30 | * @defgroup LLVMCBitReader Bit Reader |
| 31 | * @ingroup LLVMC |
| 32 | * |
| 33 | * @{ |
| 34 | */ |
| 35 | |
| 36 | /* Builds a module from the bitcode in the specified memory buffer, returning a |
| 37 | reference to the module via the OutModule parameter. Returns 0 on success. |
| 38 | Optionally returns a human-readable error message via OutMessage. |
| 39 | |
| 40 | This is deprecated. Use LLVMParseBitcode2. */ |
| 41 | LLVM_C_ABI LLVM_ATTRIBUTE_C_DEPRECATED( |
| 42 | LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, |
| 43 | LLVMModuleRef *OutModule, char **OutMessage), |
| 44 | "Use of the global context is deprecated, use LLVMParseBitcodeInContext2 " |
| 45 | "instead" ); |
| 46 | |
| 47 | /* Builds a module from the bitcode in the specified memory buffer, returning a |
| 48 | reference to the module via the OutModule parameter. Returns 0 on success. */ |
| 49 | LLVM_C_ABI LLVM_ATTRIBUTE_C_DEPRECATED( |
| 50 | LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf, |
| 51 | LLVMModuleRef *OutModule), |
| 52 | "Use of the global context is deprecated, use LLVMParseBitcodeInContext2 " |
| 53 | "instead" ); |
| 54 | |
| 55 | /* This is deprecated. Use LLVMParseBitcodeInContext2. */ |
| 56 | LLVM_C_ABI LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef, |
| 57 | LLVMMemoryBufferRef MemBuf, |
| 58 | LLVMModuleRef *OutModule, |
| 59 | char **OutMessage); |
| 60 | |
| 61 | LLVM_C_ABI LLVMBool LLVMParseBitcodeInContext2(LLVMContextRef ContextRef, |
| 62 | LLVMMemoryBufferRef MemBuf, |
| 63 | LLVMModuleRef *OutModule); |
| 64 | |
| 65 | /** Reads a module from the specified path, returning via the OutMP parameter |
| 66 | a module provider which performs lazy deserialization. Returns 0 on success. |
| 67 | Optionally returns a human-readable error message via OutMessage. |
| 68 | This is deprecated. Use LLVMGetBitcodeModuleInContext2. */ |
| 69 | LLVM_C_ABI LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef, |
| 70 | LLVMMemoryBufferRef MemBuf, |
| 71 | LLVMModuleRef *OutM, |
| 72 | char **OutMessage); |
| 73 | |
| 74 | /** Reads a module from the given memory buffer, returning via the OutMP |
| 75 | * parameter a module provider which performs lazy deserialization. |
| 76 | * |
| 77 | * Returns 0 on success. |
| 78 | * |
| 79 | * Takes ownership of \p MemBuf if (and only if) the module was read |
| 80 | * successfully. */ |
| 81 | LLVM_C_ABI LLVMBool LLVMGetBitcodeModuleInContext2(LLVMContextRef ContextRef, |
| 82 | LLVMMemoryBufferRef MemBuf, |
| 83 | LLVMModuleRef *OutM); |
| 84 | |
| 85 | /* This is deprecated. Use LLVMGetBitcodeModule2. */ |
| 86 | LLVM_C_ABI LLVM_ATTRIBUTE_C_DEPRECATED( |
| 87 | LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, |
| 88 | LLVMModuleRef *OutM, char **OutMessage), |
| 89 | "Use of the global context is deprecated, use " |
| 90 | "LLVMGetBitcodeModuleInContext2 instead" ); |
| 91 | |
| 92 | LLVM_C_ABI LLVM_ATTRIBUTE_C_DEPRECATED( |
| 93 | LLVMBool LLVMGetBitcodeModule2(LLVMMemoryBufferRef MemBuf, |
| 94 | LLVMModuleRef *OutM), |
| 95 | "Use of the global context is deprecated, use " |
| 96 | "LLVMGetBitcodeModuleInContext2 instead" ); |
| 97 | |
| 98 | /** |
| 99 | * @} |
| 100 | */ |
| 101 | |
| 102 | LLVM_C_EXTERN_C_END |
| 103 | |
| 104 | #endif |
| 105 | |