mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215989 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user