summaryrefslogtreecommitdiff
path: root/unittests/Transforms
diff options
context:
space:
mode:
authorAhmed Charles <ahmedcharles@gmail.com>2014-03-06 05:51:42 +0000
committerAhmed Charles <ahmedcharles@gmail.com>2014-03-06 05:51:42 +0000
commitf4ccd110750a3f3fe6a107d5c74c649c2a0dc407 (patch)
treeded9f38d17d1d9f3693d90f82a0a596726034174 /unittests/Transforms
parentca8b562f2d4d996d5198af537ad312e544da1172 (diff)
Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Transforms')
-rw-r--r--unittests/Transforms/DebugIR/DebugIR.cpp4
-rw-r--r--unittests/Transforms/Utils/SpecialCaseList.cpp23
2 files changed, 14 insertions, 13 deletions
diff --git a/unittests/Transforms/DebugIR/DebugIR.cpp b/unittests/Transforms/DebugIR/DebugIR.cpp
index 590fa8eac6c..497dae30cb1 100644
--- a/unittests/Transforms/DebugIR/DebugIR.cpp
+++ b/unittests/Transforms/DebugIR/DebugIR.cpp
@@ -90,8 +90,8 @@ protected:
LLVMContext Context;
char *cwd;
- OwningPtr<Module> M;
- OwningPtr<DebugIR> D;
+ std::unique_ptr<Module> M;
+ std::unique_ptr<DebugIR> D;
};
// Test empty named Module that is not supposed to be output to disk.
diff --git a/unittests/Transforms/Utils/SpecialCaseList.cpp b/unittests/Transforms/Utils/SpecialCaseList.cpp
index 07ac908caab..748834f85e0 100644
--- a/unittests/Transforms/Utils/SpecialCaseList.cpp
+++ b/unittests/Transforms/Utils/SpecialCaseList.cpp
@@ -40,7 +40,7 @@ protected:
}
SpecialCaseList *makeSpecialCaseList(StringRef List, std::string &Error) {
- OwningPtr<MemoryBuffer> MB(MemoryBuffer::getMemBuffer(List));
+ std::unique_ptr<MemoryBuffer> MB(MemoryBuffer::getMemBuffer(List));
return SpecialCaseList::create(MB.get(), Error);
}
@@ -60,9 +60,10 @@ TEST_F(SpecialCaseListTest, ModuleIsIn) {
Function *F = makeFunction("foo", M);
GlobalVariable *GV = makeGlobal("bar", "t", M);
- OwningPtr<SpecialCaseList> SCL(makeSpecialCaseList("# This is a comment.\n"
- "\n"
- "src:hello\n"));
+ std::unique_ptr<SpecialCaseList> SCL(
+ makeSpecialCaseList("# This is a comment.\n"
+ "\n"
+ "src:hello\n"));
EXPECT_TRUE(SCL->isIn(M));
EXPECT_TRUE(SCL->isIn(*F));
EXPECT_TRUE(SCL->isIn(*GV));
@@ -83,7 +84,7 @@ TEST_F(SpecialCaseListTest, FunctionIsIn) {
Function *Foo = makeFunction("foo", M);
Function *Bar = makeFunction("bar", M);
- OwningPtr<SpecialCaseList> SCL(makeSpecialCaseList("fun:foo\n"));
+ std::unique_ptr<SpecialCaseList> SCL(makeSpecialCaseList("fun:foo\n"));
EXPECT_TRUE(SCL->isIn(*Foo));
EXPECT_FALSE(SCL->isIn(*Bar));
@@ -107,7 +108,7 @@ TEST_F(SpecialCaseListTest, GlobalIsIn) {
GlobalVariable *Foo = makeGlobal("foo", "t1", M);
GlobalVariable *Bar = makeGlobal("bar", "t2", M);
- OwningPtr<SpecialCaseList> SCL(makeSpecialCaseList("global:foo\n"));
+ std::unique_ptr<SpecialCaseList> SCL(makeSpecialCaseList("global:foo\n"));
EXPECT_TRUE(SCL->isIn(*Foo));
EXPECT_FALSE(SCL->isIn(*Bar));
EXPECT_FALSE(SCL->isIn(*Foo, "init"));
@@ -157,7 +158,7 @@ TEST_F(SpecialCaseListTest, AliasIsIn) {
GlobalAlias *FooAlias = makeAlias("fooalias", Foo);
GlobalAlias *BarAlias = makeAlias("baralias", Bar);
- OwningPtr<SpecialCaseList> SCL(makeSpecialCaseList("fun:foo\n"));
+ std::unique_ptr<SpecialCaseList> SCL(makeSpecialCaseList("fun:foo\n"));
EXPECT_FALSE(SCL->isIn(*FooAlias));
EXPECT_FALSE(SCL->isIn(*BarAlias));
@@ -193,9 +194,9 @@ TEST_F(SpecialCaseListTest, Substring) {
GlobalAlias *GA1 = makeAlias("buffoonery", F);
GlobalAlias *GA2 = makeAlias("foobar", GV);
- OwningPtr<SpecialCaseList> SCL(makeSpecialCaseList("src:hello\n"
- "fun:foo\n"
- "global:bar\n"));
+ std::unique_ptr<SpecialCaseList> SCL(makeSpecialCaseList("src:hello\n"
+ "fun:foo\n"
+ "global:bar\n"));
EXPECT_FALSE(SCL->isIn(M));
EXPECT_FALSE(SCL->isIn(*F));
EXPECT_FALSE(SCL->isIn(*GV));
@@ -224,7 +225,7 @@ TEST_F(SpecialCaseListTest, InvalidSpecialCaseList) {
}
TEST_F(SpecialCaseListTest, EmptySpecialCaseList) {
- OwningPtr<SpecialCaseList> SCL(makeSpecialCaseList(""));
+ std::unique_ptr<SpecialCaseList> SCL(makeSpecialCaseList(""));
Module M("foo", Ctx);
EXPECT_FALSE(SCL->isIn(M));
}