From f4ccd110750a3f3fe6a107d5c74c649c2a0dc407 Mon Sep 17 00:00:00 2001 From: Ahmed Charles Date: Thu, 6 Mar 2014 05:51:42 +0000 Subject: Replace OwningPtr with std::unique_ptr. 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 --- unittests/Transforms/DebugIR/DebugIR.cpp | 4 ++-- unittests/Transforms/Utils/SpecialCaseList.cpp | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'unittests/Transforms') 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 M; - OwningPtr D; + std::unique_ptr M; + std::unique_ptr 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 MB(MemoryBuffer::getMemBuffer(List)); + std::unique_ptr 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 SCL(makeSpecialCaseList("# This is a comment.\n" - "\n" - "src:hello\n")); + std::unique_ptr 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 SCL(makeSpecialCaseList("fun:foo\n")); + std::unique_ptr 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 SCL(makeSpecialCaseList("global:foo\n")); + std::unique_ptr 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 SCL(makeSpecialCaseList("fun:foo\n")); + std::unique_ptr 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 SCL(makeSpecialCaseList("src:hello\n" - "fun:foo\n" - "global:bar\n")); + std::unique_ptr 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 SCL(makeSpecialCaseList("")); + std::unique_ptr SCL(makeSpecialCaseList("")); Module M("foo", Ctx); EXPECT_FALSE(SCL->isIn(M)); } -- cgit v1.2.3