[llvm] r215989 - Modernize the .ll parsing interface.

Rafael Espindola rafael.espindola at gmail.com
Tue Aug 19 09:58:54 PDT 2014


Author: rafael
Date: Tue Aug 19 11:58:54 2014
New Revision: 215989

URL: http://llvm.org/viewvc/llvm-project?rev=215989&view=rev
Log:
Modernize the .ll parsing interface.

* Use StringRef instead of std::string&
* Return a std::unique_ptr<Module> instead of taking an optional module to write
  to (was not really used).
* Use current comment style.
* Use current naming convention.

Modified:
    llvm/trunk/include/llvm/AsmParser/Parser.h
    llvm/trunk/lib/AsmParser/Parser.cpp
    llvm/trunk/lib/IRReader/IRReader.cpp
    llvm/trunk/tools/llvm-as/llvm-as.cpp
    llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp
    llvm/trunk/unittests/Analysis/CFGTest.cpp
    llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp
    llvm/trunk/unittests/Bitcode/BitReaderTest.cpp
    llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp
    llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp
    llvm/trunk/unittests/IR/DominatorTreeTest.cpp
    llvm/trunk/unittests/IR/PassManagerTest.cpp
    llvm/trunk/unittests/IR/UseTest.cpp
    llvm/trunk/unittests/IR/UserTest.cpp
    llvm/trunk/unittests/IR/ValueTest.cpp

Modified: llvm/trunk/include/llvm/AsmParser/Parser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/AsmParser/Parser.h?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/include/llvm/AsmParser/Parser.h (original)
+++ llvm/trunk/include/llvm/AsmParser/Parser.h Tue Aug 19 11:58:54 2014
@@ -14,8 +14,8 @@
 #ifndef LLVM_ASMPARSER_PARSER_H
 #define LLVM_ASMPARSER_PARSER_H
 
+#include "llvm/ADT/StringRef.h"
 #include <memory>
-#include <string>
 
 namespace llvm {
 
@@ -30,11 +30,12 @@ class LLVMContext;
 /// that this does not verify that the generated Module is valid, so you should
 /// run the verifier after parsing the file to check that it is okay.
 /// @brief Parse LLVM Assembly from a file
-Module *ParseAssemblyFile(
-  const std::string &Filename, ///< The name of the file to parse
-  SMDiagnostic &Error,         ///< Error result info.
-  LLVMContext &Context         ///< Context in which to allocate globals info.
-);
+/// @param Filename The name of the file to parse
+/// @param Error Error result info.
+/// @param Context Context in which to allocate globals info.
+std::unique_ptr<Module> parseAssemblyFile(StringRef Filename,
+                                          SMDiagnostic &Error,
+                                          LLVMContext &Context);
 
 /// The function is a secondary interface to the LLVM Assembly Parser. It parses
 /// an ASCII string that (presumably) contains LLVM Assembly code. It returns a
@@ -42,21 +43,21 @@ Module *ParseAssemblyFile(
 /// that this does not verify that the generated Module is valid, so you should
 /// run the verifier after parsing the file to check that it is okay.
 /// @brief Parse LLVM Assembly from a string
-Module *ParseAssemblyString(
-  const char *AsmString, ///< The string containing assembly
-  Module *M,             ///< A module to add the assembly too.
-  SMDiagnostic &Error,   ///< Error result info.
-  LLVMContext &Context
-);
+/// @param AsmString The string containing assembly
+/// @param Error Error result info.
+/// @param Context Context in which to allocate globals info.
+std::unique_ptr<Module> parseAssemblyString(StringRef AsmString,
+                                            SMDiagnostic &Error,
+                                            LLVMContext &Context);
 
 /// This function is the low-level interface to the LLVM Assembly Parser.
 /// ParseAssemblyFile and ParseAssemblyString are wrappers around this function.
 /// @brief Parse LLVM Assembly from a MemoryBuffer.
-Module *ParseAssembly(
-    std::unique_ptr<MemoryBuffer> F, ///< The MemoryBuffer containing assembly
-    Module *M,                       ///< A module to add the assembly too.
-    SMDiagnostic &Err,               ///< Error result info.
-    LLVMContext &Context);
+/// @param F The MemoryBuffer containing assembly
+/// @param Err Error result info.
+/// @param Context Context in which to allocate globals info.
+std::unique_ptr<Module> parseAssembly(std::unique_ptr<MemoryBuffer> F,
+                                      SMDiagnostic &Err, LLVMContext &Context);
 
 } // End llvm namespace
 

Modified: llvm/trunk/lib/AsmParser/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Parser.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/Parser.cpp (original)
+++ llvm/trunk/lib/AsmParser/Parser.cpp Tue Aug 19 11:58:54 2014
@@ -21,25 +21,23 @@
 #include <system_error>
 using namespace llvm;
 
-Module *llvm::ParseAssembly(std::unique_ptr<MemoryBuffer> F, Module *M,
-                            SMDiagnostic &Err, LLVMContext &Context) {
+std::unique_ptr<Module> llvm::parseAssembly(std::unique_ptr<MemoryBuffer> F,
+                                            SMDiagnostic &Err,
+                                            LLVMContext &Context) {
   SourceMgr SM;
   MemoryBuffer *Buf = F.get();
   SM.AddNewSourceBuffer(F.release(), SMLoc());
 
-  // If we are parsing into an existing module, do it.
-  if (M)
-    return LLParser(Buf->getBuffer(), SM, Err, M).Run() ? nullptr : M;
-
-  // Otherwise create a new module.
-  std::unique_ptr<Module> M2(new Module(Buf->getBufferIdentifier(), Context));
-  if (LLParser(Buf->getBuffer(), SM, Err, M2.get()).Run())
+  std::unique_ptr<Module> M =
+      make_unique<Module>(Buf->getBufferIdentifier(), Context);
+  if (LLParser(Buf->getBuffer(), SM, Err, M.get()).Run())
     return nullptr;
-  return M2.release();
+  return std::move(M);
 }
 
-Module *llvm::ParseAssemblyFile(const std::string &Filename, SMDiagnostic &Err,
-                                LLVMContext &Context) {
+std::unique_ptr<Module> llvm::parseAssemblyFile(StringRef Filename,
+                                                SMDiagnostic &Err,
+                                                LLVMContext &Context) {
   ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =
       MemoryBuffer::getFileOrSTDIN(Filename);
   if (std::error_code EC = FileOrErr.getError()) {
@@ -48,13 +46,14 @@ Module *llvm::ParseAssemblyFile(const st
     return nullptr;
   }
 
-  return ParseAssembly(std::move(FileOrErr.get()), nullptr, Err, Context);
+  return parseAssembly(std::move(FileOrErr.get()), Err, Context);
 }
 
-Module *llvm::ParseAssemblyString(const char *AsmString, Module *M,
-                                  SMDiagnostic &Err, LLVMContext &Context) {
-  MemoryBuffer *F =
-      MemoryBuffer::getMemBuffer(StringRef(AsmString), "<string>");
+std::unique_ptr<Module> llvm::parseAssemblyString(StringRef AsmString,
+                                                  SMDiagnostic &Err,
+                                                  LLVMContext &Context) {
+  std::unique_ptr<MemoryBuffer> F(
+      MemoryBuffer::getMemBuffer(AsmString, "<string>"));
 
-  return ParseAssembly(std::unique_ptr<MemoryBuffer>(F), M, Err, Context);
+  return parseAssembly(std::move(F), Err, Context);
 }

Modified: llvm/trunk/lib/IRReader/IRReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IRReader/IRReader.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/lib/IRReader/IRReader.cpp (original)
+++ llvm/trunk/lib/IRReader/IRReader.cpp Tue Aug 19 11:58:54 2014
@@ -29,8 +29,9 @@ namespace llvm {
 static const char *const TimeIRParsingGroupName = "LLVM IR Parsing";
 static const char *const TimeIRParsingName = "Parse IR";
 
-static Module *getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer,
-                               SMDiagnostic &Err, LLVMContext &Context) {
+static std::unique_ptr<Module>
+getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer, SMDiagnostic &Err,
+                LLVMContext &Context) {
   if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
                 (const unsigned char *)Buffer->getBufferEnd())) {
     std::string ErrMsg;
@@ -42,10 +43,10 @@ static Module *getLazyIRModule(std::uniq
     }
     // getLazyBitcodeModule takes ownership of the Buffer when successful.
     Buffer.release();
-    return ModuleOrErr.get();
+    return std::unique_ptr<Module>(ModuleOrErr.get());
   }
 
-  return ParseAssembly(std::move(Buffer), nullptr, Err, Context);
+  return parseAssembly(std::move(Buffer), Err, Context);
 }
 
 Module *llvm::getLazyIRFileModule(const std::string &Filename,
@@ -58,7 +59,7 @@ Module *llvm::getLazyIRFileModule(const
     return nullptr;
   }
 
-  return getLazyIRModule(std::move(FileOrErr.get()), Err, Context);
+  return getLazyIRModule(std::move(FileOrErr.get()), Err, Context).release();
 }
 
 Module *llvm::ParseIR(MemoryBuffer *Buffer, SMDiagnostic &Err,
@@ -78,9 +79,9 @@ Module *llvm::ParseIR(MemoryBuffer *Buff
     return M;
   }
 
-  return ParseAssembly(std::unique_ptr<MemoryBuffer>(MemoryBuffer::getMemBuffer(
+  return parseAssembly(std::unique_ptr<MemoryBuffer>(MemoryBuffer::getMemBuffer(
                            Buffer->getBuffer(), Buffer->getBufferIdentifier())),
-                       nullptr, Err, Context);
+                       Err, Context).release();
 }
 
 Module *llvm::ParseIRFile(const std::string &Filename, SMDiagnostic &Err,

Modified: llvm/trunk/tools/llvm-as/llvm-as.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/llvm-as.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-as/llvm-as.cpp (original)
+++ llvm/trunk/tools/llvm-as/llvm-as.cpp Tue Aug 19 11:58:54 2014
@@ -94,7 +94,7 @@ int main(int argc, char **argv) {
 
   // Parse the file now...
   SMDiagnostic Err;
-  std::unique_ptr<Module> M(ParseAssemblyFile(InputFilename, Err, Context));
+  std::unique_ptr<Module> M = parseAssemblyFile(InputFilename, Err, Context);
   if (!M.get()) {
     Err.print(argv[0], errs());
     return 1;

Modified: llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp (original)
+++ llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp Tue Aug 19 11:58:54 2014
@@ -168,7 +168,7 @@ std::unique_ptr<Module> TempFile::readBi
 std::unique_ptr<Module> TempFile::readAssembly(LLVMContext &Context) const {
   DEBUG(dbgs() << " - read assembly\n");
   SMDiagnostic Err;
-  std::unique_ptr<Module> M(ParseAssemblyFile(Filename, Err, Context));
+  std::unique_ptr<Module> M = parseAssemblyFile(Filename, Err, Context);
   if (!M.get())
     DEBUG(dbgs() << "error: "; Err.print("verify-use-list-order", dbgs()));
   return M;

Modified: llvm/trunk/unittests/Analysis/CFGTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/CFGTest.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/unittests/Analysis/CFGTest.cpp (original)
+++ llvm/trunk/unittests/Analysis/CFGTest.cpp Tue Aug 19 11:58:54 2014
@@ -30,20 +30,16 @@ namespace {
 class IsPotentiallyReachableTest : public testing::Test {
 protected:
   void ParseAssembly(const char *Assembly) {
-    M.reset(new Module("Module", getGlobalContext()));
-
     SMDiagnostic Error;
-    bool Parsed = ParseAssemblyString(Assembly, M.get(),
-                                      Error, M->getContext()) == M.get();
+    M = parseAssemblyString(Assembly, Error, getGlobalContext());
 
     std::string errMsg;
     raw_string_ostream os(errMsg);
     Error.print("", os);
 
-    if (!Parsed) {
-      // A failure here means that the test itself is buggy.
+    // A failure here means that the test itself is buggy.
+    if (!M)
       report_fatal_error(os.str().c_str());
-    }
 
     Function *F = M->getFunction("test");
     if (F == nullptr)

Modified: llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp (original)
+++ llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp Tue Aug 19 11:58:54 2014
@@ -22,18 +22,16 @@ using namespace llvm;
 namespace {
 
 std::unique_ptr<Module> parseAssembly(const char *Assembly) {
-  auto M = make_unique<Module>("Module", getGlobalContext());
-
   SMDiagnostic Error;
-  bool Parsed =
-      ParseAssemblyString(Assembly, M.get(), Error, M->getContext()) == M.get();
+  std::unique_ptr<Module> M =
+      parseAssemblyString(Assembly, Error, getGlobalContext());
 
   std::string ErrMsg;
   raw_string_ostream OS(ErrMsg);
   Error.print("", OS);
 
   // A failure here means that the test itself is buggy.
-  if (!Parsed)
+  if (!M)
     report_fatal_error(OS.str().c_str());
 
   return M;

Modified: llvm/trunk/unittests/Bitcode/BitReaderTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Bitcode/BitReaderTest.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/unittests/Bitcode/BitReaderTest.cpp (original)
+++ llvm/trunk/unittests/Bitcode/BitReaderTest.cpp Tue Aug 19 11:58:54 2014
@@ -26,18 +26,16 @@ using namespace llvm;
 namespace {
 
 std::unique_ptr<Module> parseAssembly(const char *Assembly) {
-  auto M = make_unique<Module>("Module", getGlobalContext());
-
   SMDiagnostic Error;
-  bool Parsed =
-      ParseAssemblyString(Assembly, M.get(), Error, M->getContext()) == M.get();
+  std::unique_ptr<Module> M =
+      parseAssemblyString(Assembly, Error, getGlobalContext());
 
   std::string ErrMsg;
   raw_string_ostream OS(ErrMsg);
   Error.print("", OS);
 
   // A failure here means that the test itself is buggy.
-  if (!Parsed)
+  if (!M)
     report_fatal_error(OS.str().c_str());
 
   return M;

Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp Tue Aug 19 11:58:54 2014
@@ -166,15 +166,14 @@ public:
   }
 };
 
-bool LoadAssemblyInto(Module *M, const char *assembly) {
+std::unique_ptr<Module> loadAssembly(LLVMContext &C, const char *Assembly) {
   SMDiagnostic Error;
-  bool success =
-    nullptr != ParseAssemblyString(assembly, M, Error, M->getContext());
+  std::unique_ptr<Module> M = parseAssemblyString(Assembly, Error, C);
   std::string errMsg;
   raw_string_ostream os(errMsg);
   Error.print("", os);
-  EXPECT_TRUE(success) << os.str();
-  return success;
+  EXPECT_TRUE((bool)M) << os.str();
+  return M;
 }
 
 class JITTest : public testing::Test {
@@ -200,7 +199,7 @@ class JITTest : public testing::Test {
   }
 
   void LoadAssembly(const char *assembly) {
-    LoadAssemblyInto(M, assembly);
+    M = loadAssembly(Context, assembly).release();
   }
 
   LLVMContext Context;
@@ -615,14 +614,13 @@ TEST_F(JITTest, EscapedLazyStubStillCall
 // Converts the LLVM assembly to bitcode and returns it in a std::string.  An
 // empty string indicates an error.
 std::string AssembleToBitcode(LLVMContext &Context, const char *Assembly) {
-  Module TempModule("TempModule", Context);
-  if (!LoadAssemblyInto(&TempModule, Assembly)) {
+  std::unique_ptr<Module> TempModule = loadAssembly(Context, Assembly);
+  if (!TempModule)
     return "";
-  }
 
   std::string Result;
   raw_string_ostream OS(Result);
-  WriteBitcodeToFile(&TempModule, OS);
+  WriteBitcodeToFile(TempModule.get(), OS);
   OS.flush();
   return Result;
 }

Modified: llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/JIT/MultiJITTest.cpp Tue Aug 19 11:58:54 2014
@@ -27,8 +27,7 @@ namespace {
 std::unique_ptr<Module> loadAssembly(LLVMContext &Context,
                                      const char *Assembly) {
   SMDiagnostic Error;
-  std::unique_ptr<Module> Ret(
-      ParseAssemblyString(Assembly, nullptr, Error, Context));
+  std::unique_ptr<Module> Ret = parseAssemblyString(Assembly, Error, Context);
   std::string errMsg;
   raw_string_ostream os(errMsg);
   Error.print("", os);

Modified: llvm/trunk/unittests/IR/DominatorTreeTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/DominatorTreeTest.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/DominatorTreeTest.cpp (original)
+++ llvm/trunk/unittests/IR/DominatorTreeTest.cpp Tue Aug 19 11:58:54 2014
@@ -186,8 +186,7 @@ namespace llvm {
     };
     char DPass::ID = 0;
 
-
-    Module* makeLLVMModule(DPass *P) {
+    std::unique_ptr<Module> makeLLVMModule(DPass *P) {
       const char *ModuleStrig =
         "declare i32 @g()\n" \
         "define void @f(i32 %x) {\n" \
@@ -213,12 +212,12 @@ namespace llvm {
         "}\n";
       LLVMContext &C = getGlobalContext();
       SMDiagnostic Err;
-      return ParseAssemblyString(ModuleStrig, nullptr, Err, C);
+      return parseAssemblyString(ModuleStrig, Err, C);
     }
 
     TEST(DominatorTree, Unreachable) {
       DPass *P = new DPass();
-      std::unique_ptr<Module> M(makeLLVMModule(P));
+      std::unique_ptr<Module> M = makeLLVMModule(P);
       PassManager Passes;
       Passes.add(P);
       Passes.run(*M);

Modified: llvm/trunk/unittests/IR/PassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/PassManagerTest.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/PassManagerTest.cpp (original)
+++ llvm/trunk/unittests/IR/PassManagerTest.cpp Tue Aug 19 11:58:54 2014
@@ -168,7 +168,7 @@ struct TestInvalidationFunctionPass {
 Module *parseIR(const char *IR) {
   LLVMContext &C = getGlobalContext();
   SMDiagnostic Err;
-  return ParseAssemblyString(IR, nullptr, Err, C);
+  return parseAssemblyString(IR, Err, C).release();
 }
 
 class PassManagerTest : public ::testing::Test {

Modified: llvm/trunk/unittests/IR/UseTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/UseTest.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/UseTest.cpp (original)
+++ llvm/trunk/unittests/IR/UseTest.cpp Tue Aug 19 11:58:54 2014
@@ -38,7 +38,7 @@ TEST(UseTest, sort) {
                              "}\n";
   SMDiagnostic Err;
   char vnbuf[8];
-  Module *M = ParseAssemblyString(ModuleString, nullptr, Err, C);
+  std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, C);
   Function *F = M->getFunction("f");
   ASSERT_TRUE(F);
   ASSERT_TRUE(F->arg_begin() != F->arg_end());
@@ -83,7 +83,7 @@ TEST(UseTest, reverse) {
                              "}\n";
   SMDiagnostic Err;
   char vnbuf[8];
-  Module *M = ParseAssemblyString(ModuleString, nullptr, Err, C);
+  std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, C);
   Function *F = M->getFunction("f");
   ASSERT_TRUE(F);
   ASSERT_TRUE(F->arg_begin() != F->arg_end());

Modified: llvm/trunk/unittests/IR/UserTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/UserTest.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/UserTest.cpp (original)
+++ llvm/trunk/unittests/IR/UserTest.cpp Tue Aug 19 11:58:54 2014
@@ -65,7 +65,7 @@ TEST(UserTest, ValueOpIteration) {
                              "  ret void\n"
                              "}\n";
   SMDiagnostic Err;
-  Module *M = ParseAssemblyString(ModuleString, nullptr, Err, C);
+  std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, C);
 
   Function *F = M->getFunction("f");
   BasicBlock &ExitBB = F->back();

Modified: llvm/trunk/unittests/IR/ValueTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/ValueTest.cpp?rev=215989&r1=215988&r2=215989&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/ValueTest.cpp (original)
+++ llvm/trunk/unittests/IR/ValueTest.cpp Tue Aug 19 11:58:54 2014
@@ -34,7 +34,7 @@ TEST(ValueTest, UsedInBasicBlock) {
                              "  ret void\n"
                              "}\n";
   SMDiagnostic Err;
-  Module *M = ParseAssemblyString(ModuleString, nullptr, Err, C);
+  std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, C);
 
   Function *F = M->getFunction("f");
 





More information about the llvm-commits mailing list