[PATCH] D56203: [IRReader] Expose getLazyIRModule

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 11 14:01:14 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL353755: [IRReader] Expose getLazyIRModule (authored by scott.linder, committed by ).
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D56203?vs=182364&id=186327#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56203/new/

https://reviews.llvm.org/D56203

Files:
  llvm/trunk/include/llvm/IRReader/IRReader.h
  llvm/trunk/lib/IRReader/IRReader.cpp


Index: llvm/trunk/lib/IRReader/IRReader.cpp
===================================================================
--- llvm/trunk/lib/IRReader/IRReader.cpp
+++ llvm/trunk/lib/IRReader/IRReader.cpp
@@ -29,9 +29,9 @@
 static const char *const TimeIRParsingName = "parse";
 static const char *const TimeIRParsingDescription = "Parse IR";
 
-static std::unique_ptr<Module>
-getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer, SMDiagnostic &Err,
-                LLVMContext &Context, bool ShouldLazyLoadMetadata) {
+std::unique_ptr<Module>
+llvm::getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer, SMDiagnostic &Err,
+                      LLVMContext &Context, bool ShouldLazyLoadMetadata) {
   if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
                 (const unsigned char *)Buffer->getBufferEnd())) {
     Expected<std::unique_ptr<Module>> ModuleOrErr = getOwningLazyBitcodeModule(
Index: llvm/trunk/include/llvm/IRReader/IRReader.h
===================================================================
--- llvm/trunk/include/llvm/IRReader/IRReader.h
+++ llvm/trunk/include/llvm/IRReader/IRReader.h
@@ -20,11 +20,22 @@
 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. This takes ownership
+/// of \p Buffer.
+std::unique_ptr<Module> getLazyIRModule(std::unique_ptr<MemoryBuffer> 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56203.186327.patch
Type: text/x-patch
Size: 2120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190211/d0e9fc01/attachment.bin>


More information about the llvm-commits mailing list