Index: include/llvm/IRReader/IRReader.h =================================================================== --- include/llvm/IRReader/IRReader.h +++ include/llvm/IRReader/IRReader.h @@ -21,11 +21,21 @@ namespace llvm { class StringRef; +class MemoryBuffer; class MemoryBufferRef; class Module; class SMDiagnostic; class LLVMContext; +/// If the given MemoryBuffer holds a bitcode image, return a Module +/// for it which does lazy deserialization of function bodies. Otherwise, +/// attempt to parse it as LLVM Assembly and return a fully populated +/// Module. The ShouldLazyLoadMetadata flag is passed down to the bitcode +/// reader to optionally enable lazy metadata loading. +std::unique_ptr getLazyIRModule(std::unique_ptr Buffer, + SMDiagnostic &Err, LLVMContext &Context, + bool ShouldLazyLoadMetadata = false); + /// If the given file holds a bitcode image, return a Module /// for it which does lazy deserialization of function bodies. Otherwise, /// attempt to parse it as LLVM Assembly and return a fully populated Index: lib/IRReader/IRReader.cpp =================================================================== --- lib/IRReader/IRReader.cpp +++ lib/IRReader/IRReader.cpp @@ -30,9 +30,9 @@ static const char *const TimeIRParsingName = "parse"; static const char *const TimeIRParsingDescription = "Parse IR"; -static std::unique_ptr -getLazyIRModule(std::unique_ptr Buffer, SMDiagnostic &Err, - LLVMContext &Context, bool ShouldLazyLoadMetadata) { +std::unique_ptr +llvm::getLazyIRModule(std::unique_ptr Buffer, SMDiagnostic &Err, + LLVMContext &Context, bool ShouldLazyLoadMetadata) { if (isBitcode((const unsigned char *)Buffer->getBufferStart(), (const unsigned char *)Buffer->getBufferEnd())) { Expected> ModuleOrErr = getOwningLazyBitcodeModule(