summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
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
commit56440fd8203f581b9aded68db3631ea11a72ccf2 (patch)
tree7f80c03b91a2d762573379b2624e3f1de93e6ab6 /llvm/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
parent47c254beb732a4434f814c4415cbc60503dd331a (diff)
downloadbcm5719-llvm-56440fd8203f581b9aded68db3631ea11a72ccf2.tar.gz
bcm5719-llvm-56440fd8203f581b9aded68db3631ea11a72ccf2.zip
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. llvm-svn: 203083
Diffstat (limited to 'llvm/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp')
-rw-r--r--llvm/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/llvm/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp b/llvm/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
index 731f7807f59..ab308844f27 100644
--- a/llvm/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud