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

@ -30,20 +30,16 @@ namespace {
class IsPotentiallyReachableTest : public testing::Test {
protected:
void ParseAssembly(const char *Assembly) {
M.reset(new Module("Module", getGlobalContext()));
SMDiagnostic Error;
bool Parsed = ParseAssemblyString(Assembly, M.get(),
Error, M->getContext()) == M.get();
M = parseAssemblyString(Assembly, Error, getGlobalContext());
std::string errMsg;
raw_string_ostream os(errMsg);
Error.print("", os);
if (!Parsed) {
// A failure here means that the test itself is buggy.
// A failure here means that the test itself is buggy.
if (!M)
report_fatal_error(os.str().c_str());
}
Function *F = M->getFunction("test");
if (F == nullptr)