1 //===- BitcodeReader.h - Internal BitcodeReader impl ------------*- 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 the BitcodeReader class.
12 //===----------------------------------------------------------------------===//
14 #ifndef BITCODE_READER_H
15 #define BITCODE_READER_H
17 #include "llvm/AbstractTypeUser.h"
18 #include "llvm/ModuleProvider.h"
19 #include "../LLVMBitCodes.h"
23 class BitstreamReader;
25 class BitcodeReader : public ModuleProvider {
26 const char *ErrorString;
28 std::vector<PATypeHolder> TypeList;
30 virtual ~BitcodeReader() {}
32 virtual void FreeState() {}
34 virtual bool materializeFunction(Function *F, std::string *ErrInfo = 0) {
39 virtual Module *materializeModule(std::string *ErrInfo = 0) {
41 //if (ParseAllFunctionBodies(ErrMsg))
46 bool Error(const char *Str) {
50 const char *getErrorString() const { return ErrorString; }
52 /// @brief Main interface to parsing a bitcode buffer.
53 /// @returns true if an error occurred.
54 bool ParseBitcode(unsigned char *Buf, unsigned Length,
55 const std::string &ModuleID);
57 const Type *getTypeByID(unsigned ID, bool isTypeTable = false);
59 bool ParseModule(BitstreamReader &Stream, const std::string &ModuleID);
60 bool ParseTypeTable(BitstreamReader &Stream);
61 bool ParseTypeSymbolTable(BitstreamReader &Stream);
64 } // End llvm namespace