diff options
Diffstat (limited to 'unittests/ExecutionEngine')
10 files changed, 77 insertions, 87 deletions
diff --git a/unittests/ExecutionEngine/ExecutionEngineTest.cpp b/unittests/ExecutionEngine/ExecutionEngineTest.cpp index 3e304e7986..e6f07dce1e 100644 --- a/unittests/ExecutionEngine/ExecutionEngineTest.cpp +++ b/unittests/ExecutionEngine/ExecutionEngineTest.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "llvm/ExecutionEngine/Interpreter.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/LLVMContext.h" @@ -38,7 +37,7 @@ protected: Module *const M; std::string Error; - const OwningPtr<ExecutionEngine> Engine; + const std::unique_ptr<ExecutionEngine> Engine; }; TEST_F(ExecutionEngineTest, ForwardGlobalMapping) { diff --git a/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp b/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp index 41b4f2f774..175b9fb107 100644 --- a/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp +++ b/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "llvm/ExecutionEngine/JITEventListener.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/CodeGen/MachineCodeInfo.h" #include "llvm/ExecutionEngine/JIT.h" #include "llvm/IR/Instructions.h" @@ -69,7 +68,7 @@ class JITEventListenerTest : public testing::Test { } Module *M; - const OwningPtr<ExecutionEngine> EE; + const std::unique_ptr<ExecutionEngine> EE; }; // Tests on SystemZ disabled as we're running the old JIT diff --git a/unittests/ExecutionEngine/JIT/JITEventListenerTestCommon.h b/unittests/ExecutionEngine/JIT/JITEventListenerTestCommon.h index 7f6dad63e5..61220f545f 100644 --- a/unittests/ExecutionEngine/JIT/JITEventListenerTestCommon.h +++ b/unittests/ExecutionEngine/JIT/JITEventListenerTestCommon.h @@ -53,8 +53,8 @@ inline const char* getFilename() { template<typename WrapperT> class JITEventListenerTestBase : public testing::Test { protected: - llvm::OwningPtr<WrapperT> MockWrapper; - llvm::OwningPtr<llvm::JITEventListener> Listener; + std::unique_ptr<WrapperT> MockWrapper; + std::unique_ptr<llvm::JITEventListener> Listener; public: llvm::Module* M; diff --git a/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp b/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp index 731f7807f5..ab308844f2 100644 --- a/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp +++ b/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp @@ -9,7 +9,6 @@ #include "llvm/ExecutionEngine/JITMemoryManager.h" #include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Function.h" #include "llvm/IR/GlobalValue.h" @@ -31,27 +30,27 @@ Function *makeFakeFunction() { // the code in the case that we don't have to allocate more memory to store the // function bodies. TEST(JITMemoryManagerTest, NoAllocations) { - OwningPtr<JITMemoryManager> MemMgr( + std::unique_ptr<JITMemoryManager> MemMgr( JITMemoryManager::CreateDefaultMemManager()); uintptr_t size; std::string Error; // Allocate the functions. - OwningPtr<Function> F1(makeFakeFunction()); + std::unique_ptr<Function> F1(makeFakeFunction()); size = 1024; uint8_t *FunctionBody1 = MemMgr->startFunctionBody(F1.get(), size); memset(FunctionBody1, 0xFF, 1024); MemMgr->endFunctionBody(F1.get(), FunctionBody1, FunctionBody1 + 1024); EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error; - OwningPtr<Function> F2(makeFakeFunction()); + std::unique_ptr<Function> F2(makeFakeFunction()); size = 1024; uint8_t *FunctionBody2 = MemMgr->startFunctionBody(F2.get(), size); memset(FunctionBody2, 0xFF, 1024); MemMgr->endFunctionBody(F2.get(), FunctionBody2, FunctionBody2 + 1024); EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error; - OwningPtr<Function> F3(makeFakeFunction()); + std::unique_ptr<Function> F3(makeFakeFunction()); size = 1024; uint8_t *FunctionBody3 = MemMgr->startFunctionBody(F3.get(), size); memset(FunctionBody3, 0xFF, 1024); @@ -70,7 +69,7 @@ TEST(JITMemoryManagerTest, NoAllocations) { // Make three large functions that take up most of the space in the slab. Then // try allocating three smaller functions that don't require additional slabs. TEST(JITMemoryManagerTest, TestCodeAllocation) { - OwningPtr<JITMemoryManager> MemMgr( + std::unique_ptr<JITMemoryManager> MemMgr( JITMemoryManager::CreateDefaultMemManager()); uintptr_t size; std::string Error; @@ -81,7 +80,7 @@ TEST(JITMemoryManagerTest, TestCodeAllocation) { smallFuncSize * 2); // Allocate big functions - OwningPtr<Function> F1(makeFakeFunction()); + std::unique_ptr<Function> F1(makeFakeFunction()); size = bigFuncSize; uint8_t *FunctionBody1 = MemMgr->startFunctionBody(F1.get(), size); ASSERT_LE(bigFuncSize, size); @@ -89,7 +88,7 @@ TEST(JITMemoryManagerTest, TestCodeAllocation) { MemMgr->endFunctionBody(F1.get(), FunctionBody1, FunctionBody1 + bigFuncSize); EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error; - OwningPtr<Function> F2(makeFakeFunction()); + std::unique_ptr<Function> F2(makeFakeFunction()); size = bigFuncSize; uint8_t *FunctionBody2 = MemMgr->startFunctionBody(F2.get(), size); ASSERT_LE(bigFuncSize, size); @@ -97,7 +96,7 @@ TEST(JITMemoryManagerTest, TestCodeAllocation) { MemMgr->endFunctionBody(F2.get(), FunctionBody2, FunctionBody2 + bigFuncSize); EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error; - OwningPtr<Function> F3(makeFakeFunction()); + std::unique_ptr<Function> F3(makeFakeFunction()); size = bigFuncSize; uint8_t *FunctionBody3 = MemMgr->startFunctionBody(F3.get(), size); ASSERT_LE(bigFuncSize, size); @@ -109,7 +108,7 @@ TEST(JITMemoryManagerTest, TestCodeAllocation) { EXPECT_EQ(3U, MemMgr->GetNumCodeSlabs()); // Allocate small functions - OwningPtr<Function> F4(makeFakeFunction()); + std::unique_ptr<Function> F4(makeFakeFunction()); size = smallFuncSize; uint8_t *FunctionBody4 = MemMgr->startFunctionBody(F4.get(), size); ASSERT_LE(smallFuncSize, size); @@ -118,7 +117,7 @@ TEST(JITMemoryManagerTest, TestCodeAllocation) { FunctionBody4 + smallFuncSize); EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error; - OwningPtr<Function> F5(makeFakeFunction()); + std::unique_ptr<Function> F5(makeFakeFunction()); size = smallFuncSize; uint8_t *FunctionBody5 = MemMgr->startFunctionBody(F5.get(), size); ASSERT_LE(smallFuncSize, size); @@ -127,7 +126,7 @@ TEST(JITMemoryManagerTest, TestCodeAllocation) { FunctionBody5 + smallFuncSize); EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error; - OwningPtr<Function> F6(makeFakeFunction()); + std::unique_ptr<Function> F6(makeFakeFunction()); size = smallFuncSize; uint8_t *FunctionBody6 = MemMgr->startFunctionBody(F6.get(), size); ASSERT_LE(smallFuncSize, size); @@ -157,7 +156,7 @@ TEST(JITMemoryManagerTest, TestCodeAllocation) { // Allocate five global ints of varying widths and alignment, and check their // alignment and overlap. TEST(JITMemoryManagerTest, TestSmallGlobalInts) { - OwningPtr<JITMemoryManager> MemMgr( + std::unique_ptr<JITMemoryManager> MemMgr( JITMemoryManager::CreateDefaultMemManager()); uint8_t *a = (uint8_t *)MemMgr->allocateGlobal(8, 0); uint16_t *b = (uint16_t*)MemMgr->allocateGlobal(16, 2); @@ -204,7 +203,7 @@ TEST(JITMemoryManagerTest, TestSmallGlobalInts) { // Allocate a small global, a big global, and a third global, and make sure we // only use two slabs for that. TEST(JITMemoryManagerTest, TestLargeGlobalArray) { - OwningPtr<JITMemoryManager> MemMgr( + std::unique_ptr<JITMemoryManager> MemMgr( JITMemoryManager::CreateDefaultMemManager()); size_t Size = 4 * MemMgr->GetDefaultDataSlabSize(); uint64_t *a = (uint64_t*)MemMgr->allocateGlobal(64, 8); @@ -234,7 +233,7 @@ TEST(JITMemoryManagerTest, TestLargeGlobalArray) { // Allocate lots of medium globals so that we can test moving the bump allocator // to a new slab. TEST(JITMemoryManagerTest, TestManyGlobals) { - OwningPtr<JITMemoryManager> MemMgr( + std::unique_ptr<JITMemoryManager> MemMgr( JITMemoryManager::CreateDefaultMemManager()); size_t SlabSize = MemMgr->GetDefaultDataSlabSize(); size_t Size = 128; @@ -257,7 +256,7 @@ TEST(JITMemoryManagerTest, TestManyGlobals) { // Allocate lots of function stubs so that we can test moving the stub bump // allocator to a new slab. TEST(JITMemoryManagerTest, TestManyStubs) { - OwningPtr<JITMemoryManager> MemMgr( + std::unique_ptr<JITMemoryManager> MemMgr( JITMemoryManager::CreateDefaultMemManager()); size_t SlabSize = MemMgr->GetDefaultStubSlabSize(); size_t Size = 128; @@ -279,7 +278,7 @@ TEST(JITMemoryManagerTest, TestManyStubs) { // Check section allocation and alignment TEST(JITMemoryManagerTest, AllocateSection) { - OwningPtr<JITMemoryManager> MemMgr( + std::unique_ptr<JITMemoryManager> MemMgr( JITMemoryManager::CreateDefaultMemManager()); uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1, StringRef()); uint8_t *data1 = MemMgr->allocateDataSection(256, 16, 2, StringRef(), true); diff --git a/unittests/ExecutionEngine/JIT/JITTest.cpp b/unittests/ExecutionEngine/JIT/JITTest.cpp index 4e1d6e7890..9e65fee4b1 100644 --- a/unittests/ExecutionEngine/JIT/JITTest.cpp +++ b/unittests/ExecutionEngine/JIT/JITTest.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "llvm/ExecutionEngine/JIT.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/AsmParser/Parser.h" #include "llvm/Bitcode/ReaderWriter.h" @@ -77,7 +76,8 @@ std::string DumpFunction(const Function *F) { } class RecordingJITMemoryManager : public JITMemoryManager { - const OwningPtr<JITMemoryManager> Base; + const std::unique_ptr<JITMemoryManager> Base; + public: RecordingJITMemoryManager() : Base(JITMemoryManager::CreateDefaultMemManager()) { @@ -203,7 +203,7 @@ class JITTest : public testing::Test { LLVMContext Context; Module *M; // Owned by ExecutionEngine. RecordingJITMemoryManager *RJMM; - OwningPtr<ExecutionEngine> TheJIT; + std::unique_ptr<ExecutionEngine> TheJIT; }; // Regression test for a bug. The JIT used to allocate globals inside the same @@ -220,13 +220,13 @@ TEST(JIT, GlobalInFunction) { // memory is more easily tested. MemMgr->setPoisonMemory(true); std::string Error; - OwningPtr<ExecutionEngine> JIT(EngineBuilder(M) - .setEngineKind(EngineKind::JIT) - .setErrorStr(&Error) - .setJITMemoryManager(MemMgr) - // The next line enables the fix: - .setAllocateGVsWithCode(false) - .create()); + std::unique_ptr<ExecutionEngine> JIT(EngineBuilder(M) + .setEngineKind(EngineKind::JIT) + .setErrorStr(&Error) + .setJITMemoryManager(MemMgr) + // The next line enables the fix: + .setAllocateGVsWithCode(false) + .create()); ASSERT_EQ(Error, ""); // Create a global variable. @@ -669,7 +669,8 @@ TEST(LazyLoadedJITTest, MaterializableAvailableExternallyFunctionIsntCompiled) { "} "); ASSERT_FALSE(Bitcode.empty()) << "Assembling failed"; Module *M; - OwningPtr<ExecutionEngine> TheJIT(getJITFromBitcode(Context, Bitcode, M)); + std::unique_ptr<ExecutionEngine> TheJIT( + getJITFromBitcode(Context, Bitcode, M)); ASSERT_TRUE(TheJIT.get()) << "Failed to create JIT."; TheJIT->DisableLazyCompilation(true); @@ -708,7 +709,8 @@ TEST(LazyLoadedJITTest, EagerCompiledRecursionThroughGhost) { "} "); ASSERT_FALSE(Bitcode.empty()) << "Assembling failed"; Module *M; - OwningPtr<ExecutionEngine> TheJIT(getJITFromBitcode(Context, Bitcode, M)); + std::unique_ptr<ExecutionEngine> TheJIT( + getJITFromBitcode(Context, Bitcode, M)); ASSERT_TRUE(TheJIT.get()) << "Failed to create JIT."; TheJIT->DisableLazyCompilation(true); diff --git a/unittests/ExecutionEngine/JIT/MultiJITTest.cpp b/unittests/ExecutionEngine/JIT/MultiJITTest.cpp index 92b7a92acb..48aa955769 100644 --- a/unittests/ExecutionEngine/JIT/MultiJITTest.cpp +++ b/unittests/ExecutionEngine/JIT/MultiJITTest.cpp @@ -81,9 +81,9 @@ TEST(MultiJitTest, EagerMode) { createModule2(Context2, M2, FooF2); // Now we create the JIT in eager mode - OwningPtr<ExecutionEngine> EE1(EngineBuilder(M1).create()); + std::unique_ptr<ExecutionEngine> EE1(EngineBuilder(M1).create()); EE1->DisableLazyCompilation(true); - OwningPtr<ExecutionEngine> EE2(EngineBuilder(M2).create()); + std::unique_ptr<ExecutionEngine> EE2(EngineBuilder(M2).create()); EE2->DisableLazyCompilation(true); // Call the `foo' function with no arguments: @@ -111,9 +111,9 @@ TEST(MultiJitTest, LazyMode) { createModule2(Context2, M2, FooF2); // Now we create the JIT in lazy mode - OwningPtr<ExecutionEngine> EE1(EngineBuilder(M1).create()); + std::unique_ptr<ExecutionEngine> EE1(EngineBuilder(M1).create()); EE1->DisableLazyCompilation(false); - OwningPtr<ExecutionEngine> EE2(EngineBuilder(M2).create()); + std::unique_ptr<ExecutionEngine> EE2(EngineBuilder(M2).create()); EE2->DisableLazyCompilation(false); // Call the `foo' function with no arguments: @@ -145,8 +145,8 @@ TEST(MultiJitTest, JitPool) { createModule2(Context2, M2, FooF2); // Now we create two JITs - OwningPtr<ExecutionEngine> EE1(EngineBuilder(M1).create()); - OwningPtr<ExecutionEngine> EE2(EngineBuilder(M2).create()); + std::unique_ptr<ExecutionEngine> EE1(EngineBuilder(M1).create()); + std::unique_ptr<ExecutionEngine> EE2(EngineBuilder(M2).create()); Function *F1 = EE1->FindFunctionNamed("foo1"); void *foo1 = EE1->getPointerToFunction(F1); diff --git a/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp index c24346de84..f862999da8 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "llvm/ExecutionEngine/SectionMemoryManager.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ExecutionEngine/JIT.h" #include "gtest/gtest.h" @@ -17,7 +16,7 @@ using namespace llvm; namespace { TEST(MCJITMemoryManagerTest, BasicAllocations) { - OwningPtr<SectionMemoryManager> MemMgr(new SectionMemoryManager()); + std::unique_ptr<SectionMemoryManager> MemMgr(new SectionMemoryManager()); uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1, ""); uint8_t *data1 = MemMgr->allocateDataSection(256, 0, 2, "", true); @@ -50,7 +49,7 @@ TEST(MCJITMemoryManagerTest, BasicAllocations) { } TEST(MCJITMemoryManagerTest, LargeAllocations) { - OwningPtr<SectionMemoryManager> MemMgr(new SectionMemoryManager()); + std::unique_ptr<SectionMemoryManager> MemMgr(new SectionMemoryManager()); uint8_t *code1 = MemMgr->allocateCodeSection(0x100000, 0, 1, ""); uint8_t *data1 = MemMgr->allocateDataSection(0x100000, 0, 2, "", true); @@ -83,7 +82,7 @@ TEST(MCJITMemoryManagerTest, LargeAllocations) { } TEST(MCJITMemoryManagerTest, ManyAllocations) { - OwningPtr<SectionMemoryManager> MemMgr(new SectionMemoryManager()); + std::unique_ptr<SectionMemoryManager> MemMgr(new SectionMemoryManager()); uint8_t* code[10000]; uint8_t* data[10000]; @@ -118,7 +117,7 @@ TEST(MCJITMemoryManagerTest, ManyAllocations) { } TEST(MCJITMemoryManagerTest, ManyVariedAllocations) { - OwningPtr<SectionMemoryManager> MemMgr(new SectionMemoryManager()); + std::unique_ptr<SectionMemoryManager> MemMgr(new SectionMemoryManager()); uint8_t* code[10000]; uint8_t* data[10000]; diff --git a/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp index 62ed0a8cb1..c5ca36e417 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp @@ -90,7 +90,7 @@ TEST_F(MCJITMultipleModuleTest, multiple_empty_modules) { TEST_F(MCJITMultipleModuleTest, two_module_case) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B; + std::unique_ptr<Module> A, B; Function *FA, *FB; createTwoModuleCase(A, FA, B, FB); @@ -110,7 +110,7 @@ TEST_F(MCJITMultipleModuleTest, two_module_case) { TEST_F(MCJITMultipleModuleTest, two_module_reverse_case) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B; + std::unique_ptr<Module> A, B; Function *FA, *FB; createTwoModuleCase(A, FA, B, FB); @@ -131,7 +131,7 @@ TEST_F(MCJITMultipleModuleTest, two_module_reverse_case) { TEST_F(MCJITMultipleModuleTest, two_module_extern_reverse_case) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B; + std::unique_ptr<Module> A, B; Function *FA, *FB; createTwoModuleExternCase(A, FA, B, FB); @@ -152,7 +152,7 @@ TEST_F(MCJITMultipleModuleTest, two_module_extern_reverse_case) { TEST_F(MCJITMultipleModuleTest, two_module_extern_case) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B; + std::unique_ptr<Module> A, B; Function *FA, *FB; createTwoModuleExternCase(A, FA, B, FB); @@ -172,7 +172,7 @@ TEST_F(MCJITMultipleModuleTest, two_module_extern_case) { TEST_F(MCJITMultipleModuleTest, two_module_consecutive_call_case) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B; + std::unique_ptr<Module> A, B; Function *FA1, *FA2, *FB; createTwoModuleExternCase(A, FA1, B, FB); FA2 = insertSimpleCallFunction<int32_t(int32_t, int32_t)>(A.get(), FA1); @@ -199,7 +199,7 @@ TEST_F(MCJITMultipleModuleTest, two_module_consecutive_call_case) { TEST_F(MCJITMultipleModuleTest, two_module_global_variables_case) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B; + std::unique_ptr<Module> A, B; Function *FA, *FB; GlobalVariable *GVA, *GVB; A.reset(createEmptyModule("A")); @@ -237,7 +237,7 @@ TEST_F(MCJITMultipleModuleTest, two_module_global_variables_case) { TEST_F(MCJITMultipleModuleTest, three_module_case) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B, C; + std::unique_ptr<Module> A, B, C; Function *FA, *FB, *FC; createThreeModuleCase(A, FA, B, FB, C, FC); @@ -262,7 +262,7 @@ TEST_F(MCJITMultipleModuleTest, three_module_case) { TEST_F(MCJITMultipleModuleTest, three_module_case_reverse_order) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B, C; + std::unique_ptr<Module> A, B, C; Function *FA, *FB, *FC; createThreeModuleCase(A, FA, B, FB, C, FC); @@ -287,7 +287,7 @@ TEST_F(MCJITMultipleModuleTest, three_module_case_reverse_order) { TEST_F(MCJITMultipleModuleTest, three_module_chain_case) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B, C; + std::unique_ptr<Module> A, B, C; Function *FA, *FB, *FC; createThreeModuleChainedCallsCase(A, FA, B, FB, C, FC); @@ -312,7 +312,7 @@ TEST_F(MCJITMultipleModuleTest, three_module_chain_case) { TEST_F(MCJITMultipleModuleTest, three_modules_chain_case_reverse_order) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B, C; + std::unique_ptr<Module> A, B, C; Function *FA, *FB, *FC; createThreeModuleChainedCallsCase(A, FA, B, FB, C, FC); @@ -337,7 +337,7 @@ TEST_F(MCJITMultipleModuleTest, three_modules_chain_case_reverse_order) { TEST_F(MCJITMultipleModuleTest, cross_module_dependency_case) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B; + std::unique_ptr<Module> A, B; Function *FA, *FB1, *FB2; createCrossModuleRecursiveCase(A, FA, B, FB1, FB2); @@ -358,7 +358,7 @@ TEST_F(MCJITMultipleModuleTest, cross_module_dependency_case) { TEST_F(MCJITMultipleModuleTest, cross_module_dependency_case_reverse_order) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B; + std::unique_ptr<Module> A, B; Function *FA, *FB1, *FB2; createCrossModuleRecursiveCase(A, FA, B, FB1, FB2); @@ -379,7 +379,7 @@ TEST_F(MCJITMultipleModuleTest, cross_module_dependency_case_reverse_order) { TEST_F(MCJITMultipleModuleTest, cross_module_dependency_case3) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<Module> A, B; + std::unique_ptr<Module> A, B; Function *FA, *FB1, *FB2; createCrossModuleRecursiveCase(A, FA, B, FB1, FB2); diff --git a/unittests/ExecutionEngine/MCJIT/MCJITObjectCacheTest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITObjectCacheTest.cpp index f16928b7a9..46847d3e51 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITObjectCacheTest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITObjectCacheTest.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "llvm/ADT/OwningPtr.h" #include "MCJITTestBase.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" @@ -101,7 +100,7 @@ protected: void compileAndRun(int ExpectedRC = OriginalRC) { // This function shouldn't be called until after SetUp. - ASSERT_TRUE(TheJIT.isValid()); + ASSERT_TRUE(bool(TheJIT)); ASSERT_TRUE(0 != Main); // We may be using a null cache, so ensure compilation is valid. @@ -133,7 +132,7 @@ TEST_F(MCJITObjectCacheTest, SetNullObjectCache) { TEST_F(MCJITObjectCacheTest, VerifyBasicObjectCaching) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<TestObjectCache> Cache(new TestObjectCache); + std::unique_ptr<TestObjectCache> Cache(new TestObjectCache); // Save a copy of the module pointer before handing it off to MCJIT. const Module * SavedModulePointer = M.get(); @@ -162,7 +161,7 @@ TEST_F(MCJITObjectCacheTest, VerifyBasicObjectCaching) { TEST_F(MCJITObjectCacheTest, VerifyLoadFromCache) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<TestObjectCache> Cache(new TestObjectCache); + std::unique_ptr<TestObjectCache> Cache(new TestObjectCache); // Compile this module with an MCJIT engine createJIT(M.release()); @@ -196,7 +195,7 @@ TEST_F(MCJITObjectCacheTest, VerifyLoadFromCache) { TEST_F(MCJITObjectCacheTest, VerifyNonLoadFromCache) { SKIP_UNSUPPORTED_PLATFORM; - OwningPtr<TestObjectCache> Cache(new TestObjectCache); + std::unique_ptr<TestObjectCache> Cache(new TestObjectCache); // Compile this module with an MCJIT engine createJIT(M.release()); diff --git a/unittests/ExecutionEngine/MCJIT/MCJITTestBase.h b/unittests/ExecutionEngine/MCJIT/MCJITTestBase.h index a8f6b2b1b8..b2cb3bbef6 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITTestBase.h +++ b/unittests/ExecutionEngine/MCJIT/MCJITTestBase.h @@ -185,11 +185,9 @@ protected: // Populates Modules A and B: // Module A { Extern FB1, Function FA which calls FB1 }, // Module B { Extern FA, Function FB1, Function FB2 which calls FA }, - void createCrossModuleRecursiveCase(OwningPtr<Module> &A, - Function *&FA, - OwningPtr<Module> &B, - Function *&FB1, - Function *&FB2) { + void createCrossModuleRecursiveCase(std::unique_ptr<Module> &A, Function *&FA, + std::unique_ptr<Module> &B, + Function *&FB1, Function *&FB2) { // Define FB1 in B. B.reset(createEmptyModule("B")); FB1 = insertAccumulateFunction(B.get(), 0, "FB1"); @@ -211,12 +209,10 @@ protected: // Module A { Function FA }, // Module B { Extern FA, Function FB which calls FA }, // Module C { Extern FB, Function FC which calls FB }, - void createThreeModuleChainedCallsCase(OwningPtr<Module> &A, - Function *&FA, - OwningPtr<Module> &B, - Function *&FB, - OwningPtr<Module> &C, - Function *&FC) { + void + createThreeModuleChainedCallsCase(std::unique_ptr<Module> &A, Function *&FA, + std::unique_ptr<Module> &B, Function *&FB, + std::unique_ptr<Module> &C, Function *&FC) { A.reset(createEmptyModule("A")); FA = insertAddFunction(A.get()); @@ -233,8 +229,8 @@ protected: // Module A { Function FA }, // Populates Modules A and B: // Module B { Function FB } - void createTwoModuleCase(OwningPtr<Module> &A, Function *&FA, - OwningPtr<Module> &B, Function *&FB) { + void createTwoModuleCase(std::unique_ptr<Module> &A, Function *&FA, + std::unique_ptr<Module> &B, Function *&FB) { A.reset(createEmptyModule("A")); FA = insertAddFunction(A.get()); @@ -244,8 +240,8 @@ protected: // Module A { Function FA }, // Module B { Extern FA, Function FB which calls FA } - void createTwoModuleExternCase(OwningPtr<Module> &A, Function *&FA, - OwningPtr<Module> &B, Function *&FB) { + void createTwoModuleExternCase(std::unique_ptr<Module> &A, Function *&FA, + std::unique_ptr<Module> &B, Function *&FB) { A.reset(createEmptyModule("A")); FA = insertAddFunction(A.get()); @@ -258,12 +254,9 @@ protected: // Module A { Function FA }, // Module B { Extern FA, Function FB which calls FA }, // Module C { Extern FB, Function FC which calls FA }, - void createThreeModuleCase(OwningPtr<Module> &A, - Function *&FA, - OwningPtr<Module> &B, - Function *&FB, - OwningPtr<Module> &C, - Function *&FC) { + void createThreeModuleCase(std::unique_ptr<Module> &A, Function *&FA, + std::unique_ptr<Module> &B, Function *&FB, + std::unique_ptr<Module> &C, Function *&FC) { A.reset(createEmptyModule("A")); FA = insertAddFunction(A.get()); @@ -342,10 +335,10 @@ protected: CodeModel::Model CodeModel; StringRef MArch; SmallVector<std::string, 1> MAttrs; - OwningPtr<ExecutionEngine> TheJIT; + std::unique_ptr<ExecutionEngine> TheJIT; RTDyldMemoryManager *MM; - OwningPtr<Module> M; + std::unique_ptr<Module> M; }; } // namespace llvm |