mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Split parseAssembly into parseAssembly and parseAssemblyInto.
This should restore the functionality of parsing new code into an existing module without the confusing interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216031 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -21,17 +21,24 @@
|
||||
#include <system_error>
|
||||
using namespace llvm;
|
||||
|
||||
bool llvm::parseAssemblyInto(std::unique_ptr<MemoryBuffer> F, Module &M,
|
||||
SMDiagnostic &Err) {
|
||||
SourceMgr SM;
|
||||
StringRef Buf = F->getBuffer();
|
||||
SM.AddNewSourceBuffer(F.release(), SMLoc());
|
||||
|
||||
return LLParser(Buf, SM, Err, &M).Run();
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
std::unique_ptr<Module> M =
|
||||
make_unique<Module>(Buf->getBufferIdentifier(), Context);
|
||||
if (LLParser(Buf->getBuffer(), SM, Err, M.get()).Run())
|
||||
make_unique<Module>(F->getBufferIdentifier(), Context);
|
||||
|
||||
if (parseAssemblyInto(std::move(F), *M, Err))
|
||||
return nullptr;
|
||||
|
||||
return std::move(M);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user