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:
Rafael Espindola
2014-08-19 16:58:54 +00:00
parent 2788345a9b
commit 9b29ff99c0
15 changed files with 71 additions and 82 deletions

View File

@ -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;