- // If we are parsing into an existing module, do it.
- if (M)
- return LLParser(F, SM, Err, M).Run() ? nullptr : M;
+ return LLParser(Buf, SM, Err, &M).Run();
+}
+
+std::unique_ptr<Module> llvm::parseAssembly(std::unique_ptr<MemoryBuffer> F,
+ SMDiagnostic &Err,
+ LLVMContext &Context) {
+ std::unique_ptr<Module> M =
+ make_unique<Module>(F->getBufferIdentifier(), Context);