1 //===-- llvm/Bitcode/ReaderWriter.h - Bitcode reader/writers ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Chris Lattner and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This header defines interfaces to read and write LLVM bitcode files/streams.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_BITCODE_H
15 #define LLVM_BITCODE_H
25 /// getBitcodeModuleProvider - Read the header of the specified bitcode buffer
26 /// and prepare for lazy deserialization of function bodies. If successful,
27 /// this takes ownership of 'buffer' and returns a non-null pointer. On
28 /// error, this returns null, *does not* take ownership of Buffer, and fills
29 /// in *ErrMsg with an error description if ErrMsg is non-null.
30 ModuleProvider *getBitcodeModuleProvider(MemoryBuffer *Buffer,
31 std::string *ErrMsg = 0);
33 /// ParseBitcodeFile - Read the specified bitcode file, returning the module.
34 /// If an error occurs, this returns null and fills in *ErrMsg if it is
35 /// non-null. This method *never* takes ownership of Buffer.
36 Module *ParseBitcodeFile(MemoryBuffer *Buffer, std::string *ErrMsg = 0);
38 /// WriteBitcodeToFile - Write the specified module to the specified output
40 void WriteBitcodeToFile(const Module *M, std::ostream &Out);
41 } // End llvm namespace