[PATCH] D56203: [IRReader] Expose getLazyIRModule

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 17 11:45:02 PST 2019


scott.linder updated this revision to Diff 182364.
scott.linder added a comment.

Rebase and ping


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

https://reviews.llvm.org/D56203

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


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<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: 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<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.182364.patch
Type: text/x-patch
Size: 2014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190117/75e209d5/attachment.bin>


More information about the llvm-commits mailing list