1 /*===-- llvm-c/BitReader.h - BitReader Library C Interface ------*- C++ -*-===*\
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
5 |* See https://llvm.org/LICENSE.txt for license information. *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
8 |*===----------------------------------------------------------------------===*|
10 |* This header declares the C interface to libLLVMBitReader.a, which *|
11 |* implements input of the LLVM bitcode format. *|
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. *|
17 \*===----------------------------------------------------------------------===*/
19 #ifndef LLVM_C_BITREADER_H
20 #define LLVM_C_BITREADER_H
22 #include "llvm-c/Types.h"
29 * @defgroup LLVMCBitReader Bit Reader
35 /* Builds a module from the bitcode in the specified memory buffer, returning a
36 reference to the module via the OutModule parameter. Returns 0 on success.
37 Optionally returns a human-readable error message via OutMessage.
39 This is deprecated. Use LLVMParseBitcode2. */
40 LLVMBool
LLVMParseBitcode(LLVMMemoryBufferRef MemBuf
, LLVMModuleRef
*OutModule
,
43 /* Builds a module from the bitcode in the specified memory buffer, returning a
44 reference to the module via the OutModule parameter. Returns 0 on success. */
45 LLVMBool
LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf
,
46 LLVMModuleRef
*OutModule
);
48 /* This is deprecated. Use LLVMParseBitcodeInContext2. */
49 LLVMBool
LLVMParseBitcodeInContext(LLVMContextRef ContextRef
,
50 LLVMMemoryBufferRef MemBuf
,
51 LLVMModuleRef
*OutModule
, char **OutMessage
);
53 LLVMBool
LLVMParseBitcodeInContext2(LLVMContextRef ContextRef
,
54 LLVMMemoryBufferRef MemBuf
,
55 LLVMModuleRef
*OutModule
);
57 /** Reads a module from the specified path, returning via the OutMP parameter
58 a module provider which performs lazy deserialization. Returns 0 on success.
59 Optionally returns a human-readable error message via OutMessage.
60 This is deprecated. Use LLVMGetBitcodeModuleInContext2. */
61 LLVMBool
LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef
,
62 LLVMMemoryBufferRef MemBuf
,
63 LLVMModuleRef
*OutM
, char **OutMessage
);
65 /** Reads a module from the specified path, returning via the OutMP parameter a
66 * module provider which performs lazy deserialization. Returns 0 on success. */
67 LLVMBool
LLVMGetBitcodeModuleInContext2(LLVMContextRef ContextRef
,
68 LLVMMemoryBufferRef MemBuf
,
71 /* This is deprecated. Use LLVMGetBitcodeModule2. */
72 LLVMBool
LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf
, LLVMModuleRef
*OutM
,
75 LLVMBool
LLVMGetBitcodeModule2(LLVMMemoryBufferRef MemBuf
, LLVMModuleRef
*OutM
);