using namespace llvm;
Module *llvm::ParseAssembly(MemoryBuffer *F,
- const std::string &Name,
Module *M,
SMDiagnostic &Err,
LLVMContext &Context) {
return LLParser(F, SM, Err, M).Run() ? 0 : M;
// Otherwise create a new module.
- OwningPtr<Module> M2(new Module(Name, Context));
+ OwningPtr<Module> M2(new Module(F->getBufferIdentifier(), Context));
if (LLParser(F, SM, Err, M2.get()).Run())
return 0;
return M2.take();
MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), &ErrorStr);
if (F == 0) {
Err = SMDiagnostic("", -1, -1,
- "Could not open input file '" + Filename + "'", "");
+ "Could not open input file '" + Filename + "': " +
+ ErrorStr, "");
return 0;
}
- return ParseAssembly(F, Filename, 0, Err, Context);
+ return ParseAssembly(F, 0, Err, Context);
}
Module *llvm::ParseAssemblyString(const char *AsmString, Module *M,
MemoryBuffer::getMemBuffer(AsmString, AsmString+strlen(AsmString),
"<string>");
- return ParseAssembly(F, "<string>", M, Err, Context);
+ return ParseAssembly(F, M, Err, Context);
}