summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-07-18 04:54:35 +0000
committerChris Lattner <sabre@nondot.org>2011-07-18 04:54:35 +0000
commitdb125cfaf57cc83e7dd7453de2d509bc8efd0e5e (patch)
treea163ac0f83da7be3f9675a122a6144b12418be09 /unittests
parent4b3d5469fb7c25504fa20dc65640f02d79675d48 (diff)
downloadllvm-db125cfaf57cc83e7dd7453de2d509bc8efd0e5e.tar.gz
llvm-db125cfaf57cc83e7dd7453de2d509bc8efd0e5e.tar.bz2
llvm-db125cfaf57cc83e7dd7453de2d509bc8efd0e5e.tar.xz
land David Blaikie's patch to de-constify Type, with a few tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/SmallVectorTest.cpp2
-rw-r--r--unittests/Analysis/ScalarEvolutionTest.cpp4
-rw-r--r--unittests/ExecutionEngine/ExecutionEngineTest.cpp2
-rw-r--r--unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp2
-rw-r--r--unittests/ExecutionEngine/JIT/JITTest.cpp12
-rw-r--r--unittests/Support/TypeBuilderTest.cpp8
-rw-r--r--unittests/VMCore/ConstantsTest.cpp8
-rw-r--r--unittests/VMCore/InstructionsTest.cpp14
-rw-r--r--unittests/VMCore/VerifierTest.cpp2
9 files changed, 27 insertions, 27 deletions
diff --git a/unittests/ADT/SmallVectorTest.cpp b/unittests/ADT/SmallVectorTest.cpp
index 0d3535d6db..d5bfe76800 100644
--- a/unittests/ADT/SmallVectorTest.cpp
+++ b/unittests/ADT/SmallVectorTest.cpp
@@ -383,7 +383,7 @@ TEST_F(SmallVectorTest, ComparisonTest) {
// Constant vector tests.
TEST_F(SmallVectorTest, ConstVectorTest) {
- const VectorType constVector;
+ VectorType constVector;
EXPECT_EQ(0u, constVector.size());
EXPECT_TRUE(constVector.empty());
diff --git a/unittests/Analysis/ScalarEvolutionTest.cpp b/unittests/Analysis/ScalarEvolutionTest.cpp
index 39ced2a16e..a09cb1c95e 100644
--- a/unittests/Analysis/ScalarEvolutionTest.cpp
+++ b/unittests/Analysis/ScalarEvolutionTest.cpp
@@ -22,13 +22,13 @@ TEST(ScalarEvolutionsTest, SCEVUnknownRAUW) {
LLVMContext Context;
Module M("world", Context);
- const FunctionType *FTy = FunctionType::get(Type::getVoidTy(Context),
+ FunctionType *FTy = FunctionType::get(Type::getVoidTy(Context),
std::vector<Type *>(), false);
Function *F = cast<Function>(M.getOrInsertFunction("f", FTy));
BasicBlock *BB = BasicBlock::Create(Context, "entry", F);
ReturnInst::Create(Context, 0, BB);
- const Type *Ty = Type::getInt1Ty(Context);
+ Type *Ty = Type::getInt1Ty(Context);
Constant *Init = Constant::getNullValue(Ty);
Value *V0 = new GlobalVariable(M, Ty, false, GlobalValue::ExternalLinkage, Init, "V0");
Value *V1 = new GlobalVariable(M, Ty, false, GlobalValue::ExternalLinkage, Init, "V1");
diff --git a/unittests/ExecutionEngine/ExecutionEngineTest.cpp b/unittests/ExecutionEngine/ExecutionEngineTest.cpp
index 904ee2b6c4..4dcef20c6e 100644
--- a/unittests/ExecutionEngine/ExecutionEngineTest.cpp
+++ b/unittests/ExecutionEngine/ExecutionEngineTest.cpp
@@ -30,7 +30,7 @@ protected:
ASSERT_TRUE(Engine.get() != NULL);
}
- GlobalVariable *NewExtGlobal(const Type *T, const Twine &Name) {
+ GlobalVariable *NewExtGlobal(Type *T, const Twine &Name) {
return new GlobalVariable(*M, T, false, // Not constant.
GlobalValue::ExternalLinkage, NULL, Name);
}
diff --git a/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp b/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
index 039b5e00f2..be5d152c1c 100644
--- a/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
+++ b/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
@@ -22,7 +22,7 @@ namespace {
Function *makeFakeFunction() {
std::vector<Type*> params;
- const FunctionType *FTy =
+ FunctionType *FTy =
FunctionType::get(Type::getVoidTy(getGlobalContext()), params, false);
return Function::Create(FTy, GlobalValue::ExternalLinkage);
}
diff --git a/unittests/ExecutionEngine/JIT/JITTest.cpp b/unittests/ExecutionEngine/JIT/JITTest.cpp
index 9c001c423f..3cac282022 100644
--- a/unittests/ExecutionEngine/JIT/JITTest.cpp
+++ b/unittests/ExecutionEngine/JIT/JITTest.cpp
@@ -38,13 +38,13 @@ namespace {
Function *makeReturnGlobal(std::string Name, GlobalVariable *G, Module *M) {
std::vector<Type*> params;
- const FunctionType *FTy = FunctionType::get(G->getType()->getElementType(),
+ FunctionType *FTy = FunctionType::get(G->getType()->getElementType(),
params, false);
Function *F = Function::Create(FTy, GlobalValue::ExternalLinkage, Name, M);
BasicBlock *Entry = BasicBlock::Create(M->getContext(), "entry", F);
IRBuilder<> builder(Entry);
Value *Load = builder.CreateLoad(G);
- const Type *GTy = G->getType()->getElementType();
+ Type *GTy = G->getType()->getElementType();
Value *Add = builder.CreateAdd(Load, ConstantInt::get(GTy, 1LL));
builder.CreateStore(Add, G);
builder.CreateRet(Add);
@@ -236,7 +236,7 @@ TEST(JIT, GlobalInFunction) {
ASSERT_EQ(Error, "");
// Create a global variable.
- const Type *GTy = Type::getInt32Ty(context);
+ Type *GTy = Type::getInt32Ty(context);
GlobalVariable *G = new GlobalVariable(
*M,
GTy,
@@ -320,11 +320,11 @@ TEST_F(JITTest, FarCallToKnownFunction) {
TEST_F(JITTest, NonLazyCompilationStillNeedsStubs) {
TheJIT->DisableLazyCompilation(true);
- const FunctionType *Func1Ty =
+ FunctionType *Func1Ty =
cast<FunctionType>(TypeBuilder<void(void), false>::get(Context));
std::vector<Type*> arg_types;
arg_types.push_back(Type::getInt1Ty(Context));
- const FunctionType *FuncTy = FunctionType::get(
+ FunctionType *FuncTy = FunctionType::get(
Type::getVoidTy(Context), arg_types, false);
Function *Func1 = Function::Create(Func1Ty, Function::ExternalLinkage,
"func1", M);
@@ -377,7 +377,7 @@ TEST_F(JITTest, NonLazyLeaksNoStubs) {
TheJIT->DisableLazyCompilation(true);
// Create two functions with a single basic block each.
- const FunctionType *FuncTy =
+ FunctionType *FuncTy =
cast<FunctionType>(TypeBuilder<int(), false>::get(Context));
Function *Func1 = Function::Create(FuncTy, Function::ExternalLinkage,
"func1", M);
diff --git a/unittests/Support/TypeBuilderTest.cpp b/unittests/Support/TypeBuilderTest.cpp
index 06091784cf..6e3fbc231f 100644
--- a/unittests/Support/TypeBuilderTest.cpp
+++ b/unittests/Support/TypeBuilderTest.cpp
@@ -184,14 +184,14 @@ class MyPortableType {
namespace llvm {
template<bool cross> class TypeBuilder<MyType, cross> {
public:
- static const StructType *get(LLVMContext &Context) {
+ static StructType *get(LLVMContext &Context) {
// Using the static result variable ensures that the type is
// only looked up once.
std::vector<Type*> st;
st.push_back(TypeBuilder<int, cross>::get(Context));
st.push_back(TypeBuilder<int*, cross>::get(Context));
st.push_back(TypeBuilder<void*[], cross>::get(Context));
- static const StructType *const result = StructType::get(Context, st);
+ static StructType *const result = StructType::get(Context, st);
return result;
}
@@ -207,14 +207,14 @@ public:
template<bool cross> class TypeBuilder<MyPortableType, cross> {
public:
- static const StructType *get(LLVMContext &Context) {
+ static StructType *get(LLVMContext &Context) {
// Using the static result variable ensures that the type is
// only looked up once.
std::vector<Type*> st;
st.push_back(TypeBuilder<types::i<32>, cross>::get(Context));
st.push_back(TypeBuilder<types::i<32>*, cross>::get(Context));
st.push_back(TypeBuilder<types::i<8>*[], cross>::get(Context));
- static const StructType *const result = StructType::get(Context, st);
+ static StructType *const result = StructType::get(Context, st);
return result;
}
diff --git a/unittests/VMCore/ConstantsTest.cpp b/unittests/VMCore/ConstantsTest.cpp
index 8277584ba2..623ea0d102 100644
--- a/unittests/VMCore/ConstantsTest.cpp
+++ b/unittests/VMCore/ConstantsTest.cpp
@@ -16,7 +16,7 @@ namespace llvm {
namespace {
TEST(ConstantsTest, Integer_i1) {
- const IntegerType* Int1 = IntegerType::get(getGlobalContext(), 1);
+ IntegerType* Int1 = IntegerType::get(getGlobalContext(), 1);
Constant* One = ConstantInt::get(Int1, 1, true);
Constant* Zero = ConstantInt::get(Int1, 0);
Constant* NegOne = ConstantInt::get(Int1, static_cast<uint64_t>(-1), true);
@@ -97,7 +97,7 @@ TEST(ConstantsTest, Integer_i1) {
}
TEST(ConstantsTest, IntSigns) {
- const IntegerType* Int8Ty = Type::getInt8Ty(getGlobalContext());
+ IntegerType* Int8Ty = Type::getInt8Ty(getGlobalContext());
EXPECT_EQ(100, ConstantInt::get(Int8Ty, 100, false)->getSExtValue());
EXPECT_EQ(100, ConstantInt::get(Int8Ty, 100, true)->getSExtValue());
EXPECT_EQ(100, ConstantInt::getSigned(Int8Ty, 100)->getSExtValue());
@@ -110,9 +110,9 @@ TEST(ConstantsTest, IntSigns) {
}
TEST(ConstantsTest, FP128Test) {
- const Type *FP128Ty = Type::getFP128Ty(getGlobalContext());
+ Type *FP128Ty = Type::getFP128Ty(getGlobalContext());
- const IntegerType *Int128Ty = Type::getIntNTy(getGlobalContext(), 128);
+ IntegerType *Int128Ty = Type::getIntNTy(getGlobalContext(), 128);
Constant *Zero128 = Constant::getNullValue(Int128Ty);
Constant *X = ConstantExpr::getUIToFP(Zero128, FP128Ty);
EXPECT_TRUE(isa<ConstantFP>(X));
diff --git a/unittests/VMCore/InstructionsTest.cpp b/unittests/VMCore/InstructionsTest.cpp
index 9624b816a8..0a01538899 100644
--- a/unittests/VMCore/InstructionsTest.cpp
+++ b/unittests/VMCore/InstructionsTest.cpp
@@ -26,7 +26,7 @@ TEST(InstructionsTest, ReturnInst) {
EXPECT_EQ(r0->getNumOperands(), 0U);
EXPECT_EQ(r0->op_begin(), r0->op_end());
- const IntegerType* Int1 = IntegerType::get(C, 1);
+ IntegerType* Int1 = IntegerType::get(C, 1);
Constant* One = ConstantInt::get(Int1, 1, true);
const ReturnInst* r1 = ReturnInst::Create(C, One);
EXPECT_EQ(r1->getNumOperands(), 1U);
@@ -64,7 +64,7 @@ TEST(InstructionsTest, BranchInst) {
EXPECT_EQ(llvm::next(b0->op_begin()), b0->op_end());
- const IntegerType* Int1 = IntegerType::get(C, 1);
+ IntegerType* Int1 = IntegerType::get(C, 1);
Constant* One = ConstantInt::get(Int1, 1, true);
// Conditional BranchInst
@@ -111,11 +111,11 @@ TEST(InstructionsTest, BranchInst) {
TEST(InstructionsTest, CastInst) {
LLVMContext &C(getGlobalContext());
- const Type* Int8Ty = Type::getInt8Ty(C);
- const Type* Int64Ty = Type::getInt64Ty(C);
- const Type* V8x8Ty = VectorType::get(Int8Ty, 8);
- const Type* V8x64Ty = VectorType::get(Int64Ty, 8);
- const Type* X86MMXTy = Type::getX86_MMXTy(C);
+ Type* Int8Ty = Type::getInt8Ty(C);
+ Type* Int64Ty = Type::getInt64Ty(C);
+ Type* V8x8Ty = VectorType::get(Int8Ty, 8);
+ Type* V8x64Ty = VectorType::get(Int64Ty, 8);
+ Type* X86MMXTy = Type::getX86_MMXTy(C);
const Constant* c8 = Constant::getNullValue(V8x8Ty);
const Constant* c64 = Constant::getNullValue(V8x64Ty);
diff --git a/unittests/VMCore/VerifierTest.cpp b/unittests/VMCore/VerifierTest.cpp
index 1924661200..324b4e193b 100644
--- a/unittests/VMCore/VerifierTest.cpp
+++ b/unittests/VMCore/VerifierTest.cpp
@@ -47,7 +47,7 @@ TEST(VerifierTest, Branch_i1) {
TEST(VerifierTest, AliasUnnamedAddr) {
LLVMContext &C = getGlobalContext();
Module M("M", C);
- const Type *Ty = Type::getInt8Ty(C);
+ Type *Ty = Type::getInt8Ty(C);
Constant *Init = Constant::getNullValue(Ty);
GlobalVariable *Aliasee = new GlobalVariable(M, Ty, true,
GlobalValue::ExternalLinkage,