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
diff --git a/unittests/IR/DominatorTreeTest.cpp b/unittests/IR/DominatorTreeTest.cpp
index ab43d1c..6c43d6f 100644
--- a/unittests/IR/DominatorTreeTest.cpp
+++ b/unittests/IR/DominatorTreeTest.cpp
@@ -186,8 +186,7 @@
};
char DPass::ID = 0;
-
- Module* makeLLVMModule(DPass *P) {
+ std::unique_ptr<Module> makeLLVMModule(DPass *P) {
const char *ModuleStrig =
"declare i32 @g()\n" \
"define void @f(i32 %x) {\n" \
@@ -213,12 +212,12 @@
"}\n";
LLVMContext &C = getGlobalContext();
SMDiagnostic Err;
- return ParseAssemblyString(ModuleStrig, nullptr, Err, C);
+ return parseAssemblyString(ModuleStrig, Err, C);
}
TEST(DominatorTree, Unreachable) {
DPass *P = new DPass();
- std::unique_ptr<Module> M(makeLLVMModule(P));
+ std::unique_ptr<Module> M = makeLLVMModule(P);
PassManager Passes;
Passes.add(P);
Passes.run(*M);
diff --git a/unittests/IR/PassManagerTest.cpp b/unittests/IR/PassManagerTest.cpp
index 25037a7..d493156 100644
--- a/unittests/IR/PassManagerTest.cpp
+++ b/unittests/IR/PassManagerTest.cpp
@@ -168,7 +168,7 @@
Module *parseIR(const char *IR) {
LLVMContext &C = getGlobalContext();
SMDiagnostic Err;
- return ParseAssemblyString(IR, nullptr, Err, C);
+ return parseAssemblyString(IR, Err, C).release();
}
class PassManagerTest : public ::testing::Test {
diff --git a/unittests/IR/UseTest.cpp b/unittests/IR/UseTest.cpp
index fa73fe7..3f33ca6 100644
--- a/unittests/IR/UseTest.cpp
+++ b/unittests/IR/UseTest.cpp
@@ -38,7 +38,7 @@
"}\n";
SMDiagnostic Err;
char vnbuf[8];
- Module *M = ParseAssemblyString(ModuleString, nullptr, Err, C);
+ std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, C);
Function *F = M->getFunction("f");
ASSERT_TRUE(F);
ASSERT_TRUE(F->arg_begin() != F->arg_end());
@@ -83,7 +83,7 @@
"}\n";
SMDiagnostic Err;
char vnbuf[8];
- Module *M = ParseAssemblyString(ModuleString, nullptr, Err, C);
+ std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, C);
Function *F = M->getFunction("f");
ASSERT_TRUE(F);
ASSERT_TRUE(F->arg_begin() != F->arg_end());
diff --git a/unittests/IR/UserTest.cpp b/unittests/IR/UserTest.cpp
index eb07e82..5572424 100644
--- a/unittests/IR/UserTest.cpp
+++ b/unittests/IR/UserTest.cpp
@@ -65,7 +65,7 @@
" ret void\n"
"}\n";
SMDiagnostic Err;
- Module *M = ParseAssemblyString(ModuleString, nullptr, Err, C);
+ std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, C);
Function *F = M->getFunction("f");
BasicBlock &ExitBB = F->back();
diff --git a/unittests/IR/ValueTest.cpp b/unittests/IR/ValueTest.cpp
index 61e44a9..dc5794b 100644
--- a/unittests/IR/ValueTest.cpp
+++ b/unittests/IR/ValueTest.cpp
@@ -34,7 +34,7 @@
" ret void\n"
"}\n";
SMDiagnostic Err;
- Module *M = ParseAssemblyString(ModuleString, nullptr, Err, C);
+ std::unique_ptr<Module> M = parseAssemblyString(ModuleString, Err, C);
Function *F = M->getFunction("f");