BitReader.h revision da1435f86ebc9886dd7704294e01d192d79e069c
1/*===-- llvm-c/BitReader.h - BitReader Library C Interface ------*- C++ -*-===*\
2|*                                                                            *|
3|*                     The LLVM Compiler Infrastructure                       *|
4|*                                                                            *|
5|* This file was developed by Gordon Henriksen and is distributed under the   *|
6|* University of Illinois Open Source License. See LICENSE.TXT for details.   *|
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_BITCODEREADER_H
20#define LLVM_C_BITCODEREADER_H
21
22#include "llvm-c/Core.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28
29/* Builds a module from the bitcode in the specified memory buffer, returning a
30   reference to the module via the OutModule parameter. Returns 0 on success.
31   Optionally returns a human-readable error message via OutMessage. */
32int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf,
33                     LLVMModuleRef *OutModule, char **OutMessage);
34
35/* Reads a module from the specified path, returning via the OutMP parameter
36   a module provider which performs lazy deserialization. Returns 0 on success.
37   Optionally returns a human-readable error message via OutMessage. */
38int LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf,
39                                 LLVMModuleProviderRef *OutMP,
40                                 char **OutMessage);
41
42
43#ifdef __cplusplus
44}
45#endif
46
47#endif
48