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/IR/ConstantsTest.cpp | 2 +- unittests/IR/DominatorTreeTest.cpp | 2 +- unittests/IR/IRBuilderTest.cpp | 5 ++--- unittests/IR/LegacyPassManagerTest.cpp | 2 +- unittests/IR/PassManagerTest.cpp | 2 +- unittests/IR/PatternMatch.cpp | 2 +- unittests/IR/ValueHandleTest.cpp | 3 +-- unittests/IR/ValueMapTest.cpp | 5 ++--- unittests/IR/ValueTest.cpp | 2 +- unittests/IR/VerifierTest.cpp | 1 - 10 files changed, 11 insertions(+), 15 deletions(-) (limited to 'unittests/IR') diff --git a/unittests/IR/ConstantsTest.cpp b/unittests/IR/ConstantsTest.cpp index fee38b891d..b3aa8102b6 100644 --- a/unittests/IR/ConstantsTest.cpp +++ b/unittests/IR/ConstantsTest.cpp @@ -162,7 +162,7 @@ TEST(ConstantsTest, PointerCast) { } TEST(ConstantsTest, AsInstructionsTest) { - OwningPtr M(new Module("MyModule", getGlobalContext())); + std::unique_ptr M(new Module("MyModule", getGlobalContext())); Type *Int64Ty = Type::getInt64Ty(getGlobalContext()); Type *Int32Ty = Type::getInt32Ty(getGlobalContext()); diff --git a/unittests/IR/DominatorTreeTest.cpp b/unittests/IR/DominatorTreeTest.cpp index d10031cb41..98c2317f2c 100644 --- a/unittests/IR/DominatorTreeTest.cpp +++ b/unittests/IR/DominatorTreeTest.cpp @@ -218,7 +218,7 @@ namespace llvm { TEST(DominatorTree, Unreachable) { DPass *P = new DPass(); - OwningPtr M(makeLLVMModule(P)); + std::unique_ptr M(makeLLVMModule(P)); PassManager Passes; Passes.add(P); Passes.run(*M); diff --git a/unittests/IR/IRBuilderTest.cpp b/unittests/IR/IRBuilderTest.cpp index 5d67e700a9..9796e44599 100644 --- a/unittests/IR/IRBuilderTest.cpp +++ b/unittests/IR/IRBuilderTest.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "llvm/IR/IRBuilder.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Function.h" @@ -41,7 +40,7 @@ protected: } LLVMContext Ctx; - OwningPtr M; + std::unique_ptr M; Function *F; BasicBlock *BB; GlobalVariable *GV; @@ -109,7 +108,7 @@ TEST_F(IRBuilderTest, LandingPadName) { } TEST_F(IRBuilderTest, DataLayout) { - OwningPtr M(new Module("test", Ctx)); + std::unique_ptr M(new Module("test", Ctx)); M->setDataLayout("e-n32"); EXPECT_TRUE(M->getDataLayout()->isLegalInteger(32)); M->setDataLayout("e"); diff --git a/unittests/IR/LegacyPassManagerTest.cpp b/unittests/IR/LegacyPassManagerTest.cpp index 284a513b52..df6f460df9 100644 --- a/unittests/IR/LegacyPassManagerTest.cpp +++ b/unittests/IR/LegacyPassManagerTest.cpp @@ -346,7 +346,7 @@ namespace llvm { template void MemoryTestHelper(int run) { - OwningPtr M(makeLLVMModule()); + std::unique_ptr M(makeLLVMModule()); T *P = new T(); PassManager Passes; Passes.add(new DataLayoutPass(M.get())); diff --git a/unittests/IR/PassManagerTest.cpp b/unittests/IR/PassManagerTest.cpp index ee1deff8df..75ba02b3a4 100644 --- a/unittests/IR/PassManagerTest.cpp +++ b/unittests/IR/PassManagerTest.cpp @@ -175,7 +175,7 @@ Module *parseIR(const char *IR) { class PassManagerTest : public ::testing::Test { protected: - OwningPtr M; + std::unique_ptr M; public: PassManagerTest() diff --git a/unittests/IR/PatternMatch.cpp b/unittests/IR/PatternMatch.cpp index da1638163f..bebee15366 100644 --- a/unittests/IR/PatternMatch.cpp +++ b/unittests/IR/PatternMatch.cpp @@ -32,7 +32,7 @@ namespace { struct PatternMatchTest : ::testing::Test { LLVMContext Ctx; - OwningPtr M; + std::unique_ptr M; Function *F; BasicBlock *BB; IRBuilder IRB; diff --git a/unittests/IR/ValueHandleTest.cpp b/unittests/IR/ValueHandleTest.cpp index bbca701776..15a0c226f7 100644 --- a/unittests/IR/ValueHandleTest.cpp +++ b/unittests/IR/ValueHandleTest.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "llvm/IR/ValueHandle.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/LLVMContext.h" @@ -336,7 +335,7 @@ TEST_F(ValueHandle, DestroyingOtherVHOnSameValueDoesntBreakIteration) { class DestroyingVH : public CallbackVH { public: - OwningPtr ToClear[2]; + std::unique_ptr ToClear[2]; DestroyingVH(Value *V) { ToClear[0].reset(new WeakVH(V)); setValPtr(V); diff --git a/unittests/IR/ValueMapTest.cpp b/unittests/IR/ValueMapTest.cpp index 2e7e5dc493..176b56cfbe 100644 --- a/unittests/IR/ValueMapTest.cpp +++ b/unittests/IR/ValueMapTest.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "llvm/IR/ValueMap.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/Config/llvm-config.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Instructions.h" @@ -24,8 +23,8 @@ template class ValueMapTest : public testing::Test { protected: Constant *ConstantV; - OwningPtr BitcastV; - OwningPtr AddV; + std::unique_ptr BitcastV; + std::unique_ptr AddV; ValueMapTest() : ConstantV(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 0)), diff --git a/unittests/IR/ValueTest.cpp b/unittests/IR/ValueTest.cpp index f10e58922e..d92bc82768 100644 --- a/unittests/IR/ValueTest.cpp +++ b/unittests/IR/ValueTest.cpp @@ -45,7 +45,7 @@ TEST(ValueTest, UsedInBasicBlock) { TEST(GlobalTest, CreateAddressSpace) { LLVMContext &Ctx = getGlobalContext(); - OwningPtr M(new Module("TestModule", Ctx)); + std::unique_ptr M(new Module("TestModule", Ctx)); Type *Int8Ty = Type::getInt8Ty(Ctx); Type *Int32Ty = Type::getInt32Ty(Ctx); diff --git a/unittests/IR/VerifierTest.cpp b/unittests/IR/VerifierTest.cpp index a5ce5fc9d3..0a660a6b91 100644 --- a/unittests/IR/VerifierTest.cpp +++ b/unittests/IR/VerifierTest.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "llvm/IR/Verifier.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" -- cgit v1.2.3