Chromium Code Reviews| Index: include/llvm/Support/IRReader.h |
| diff --git a/include/llvm/Support/IRReader.h b/include/llvm/Support/IRReader.h |
| index 6d8a9b30ae1fd8bfee9f0c9b7f6bdceb765a2743..6f5bc3aa3e496a37e82bc4aa9e1d2661821ad470 100644 |
| --- a/include/llvm/Support/IRReader.h |
| +++ b/include/llvm/Support/IRReader.h |
| @@ -21,6 +21,7 @@ |
| #include "llvm/ADT/OwningPtr.h" |
| #include "llvm/Assembly/Parser.h" |
| +#include "llvm/Bitcode/BitcodeStream.h" |
| #include "llvm/Bitcode/ReaderWriter.h" |
| #include "llvm/Support/MemoryBuffer.h" |
| #include "llvm/Support/SourceMgr.h" |
| @@ -69,6 +70,22 @@ namespace llvm { |
| return getLazyIRModule(File.take(), Err, Context); |
| } |
| + // like lazy file module but does not read the whole file at the start; |
|
jasonwkim
2011/10/25 21:34:12
Use /// for doxygen
(google.com) Derek Schuff
2011/10/25 22:23:22
Done.
|
| + // instead executes a callback to get more bytes as needed by the parser. |
| + // The stream must contain bitcode. |
| + inline Module *getLazyIRStreamModule(const std::string &Filename, |
| + SMDiagnostic &Err, |
| + LLVMContext &Context, |
| + StreamChunkCallback cb) { |
| + std::string ErrMsg; |
| + Module *M = getLazyBitcodeStreamModule(Filename, cb, Context, &ErrMsg); |
| + if (M == 0) { |
| + Err = SMDiagnostic(Filename, SourceMgr::DK_Error, ErrMsg); |
| + return 0; |
| + } |
| + return M; |
| + } |
| + |
| /// If the given MemoryBuffer holds a bitcode image, return a Module |
| /// for it. Otherwise, attempt to parse it as LLVM Assembly and return |
| /// a Module for it. This function *always* takes ownership of the given |