Move EVER MORE stuff over to LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75703 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/ExecutionEngine/JIT/JITTest.cpp b/unittests/ExecutionEngine/JIT/JITTest.cpp
index fce756b..211b6ad 100644
--- a/unittests/ExecutionEngine/JIT/JITTest.cpp
+++ b/unittests/ExecutionEngine/JIT/JITTest.cpp
@@ -30,14 +30,16 @@
Function *makeReturnGlobal(std::string Name, GlobalVariable *G, Module *M) {
std::vector<const Type*> params;
- const FunctionType *FTy = FunctionType::get(G->getType()->getElementType(),
+ const FunctionType *FTy =
+ getGlobalContext().getFunctionType(G->getType()->getElementType(),
params, false);
Function *F = Function::Create(FTy, GlobalValue::ExternalLinkage, Name, M);
BasicBlock *Entry = BasicBlock::Create("entry", F);
IRBuilder<> builder(Entry);
Value *Load = builder.CreateLoad(G);
const Type *GTy = G->getType()->getElementType();
- Value *Add = builder.CreateAdd(Load, ConstantInt::get(GTy, 1LL));
+ Value *Add = builder.CreateAdd(Load,
+ getGlobalContext().getConstantInt(GTy, 1LL));
builder.CreateStore(Add, G);
builder.CreateRet(Add);
return F;
diff --git a/unittests/Support/ValueHandleTest.cpp b/unittests/Support/ValueHandleTest.cpp
index 7a70942..17d8f18 100644
--- a/unittests/Support/ValueHandleTest.cpp
+++ b/unittests/Support/ValueHandleTest.cpp
@@ -25,8 +25,9 @@
Constant *ConstantV;
std::auto_ptr<BitCastInst> BitcastV;
- ValueHandle() : ConstantV(ConstantInt::get(Type::Int32Ty, 0)),
- BitcastV(new BitCastInst(ConstantV, Type::Int32Ty)) {
+ ValueHandle() :
+ ConstantV(getGlobalContext().getConstantInt(Type::Int32Ty, 0)),
+ BitcastV(new BitCastInst(ConstantV, Type::Int32Ty)) {
}
};
diff --git a/unittests/VMCore/MetadataTest.cpp b/unittests/VMCore/MetadataTest.cpp
index fcc9c64..c92bb13 100644
--- a/unittests/VMCore/MetadataTest.cpp
+++ b/unittests/VMCore/MetadataTest.cpp
@@ -23,9 +23,9 @@
// MDString objects, even with the same string pointer and nulls in the string.
TEST(MDStringTest, CreateDifferent) {
char x[3] = { 'f', 0, 'A' };
- MDString *s1 = MDString::get(&x[0], &x[3]);
+ MDString *s1 = getGlobalContext().getMDString(&x[0], &x[3]);
x[2] = 'B';
- MDString *s2 = MDString::get(&x[0], &x[3]);
+ MDString *s2 = getGlobalContext().getMDString(&x[0], &x[3]);
EXPECT_NE(s1, s2);
}
@@ -35,8 +35,8 @@
char x[4] = { 'a', 'b', 'c', 'X' };
char y[4] = { 'a', 'b', 'c', 'Y' };
- MDString *s1 = MDString::get(&x[0], &x[3]);
- MDString *s2 = MDString::get(&y[0], &y[3]);
+ MDString *s1 = getGlobalContext().getMDString(&x[0], &x[3]);
+ MDString *s2 = getGlobalContext().getMDString(&y[0], &y[3]);
EXPECT_EQ(s1, s2);
}
@@ -44,7 +44,7 @@
TEST(MDStringTest, PrintingSimple) {
char *str = new char[13];
strncpy(str, "testing 1 2 3", 13);
- MDString *s = MDString::get(str, str+13);
+ MDString *s = getGlobalContext().getMDString(str, str+13);
strncpy(str, "aaaaaaaaaaaaa", 13);
delete[] str;
@@ -56,7 +56,7 @@
// Test printing of MDString with non-printable characters.
TEST(MDStringTest, PrintingComplex) {
char str[5] = {0, '\n', '"', '\\', -1};
- MDString *s = MDString::get(str+0, str+5);
+ MDString *s = getGlobalContext().getMDString(str+0, str+5);
std::ostringstream oss;
s->print(oss);
EXPECT_STREQ("metadata !\"\\00\\0A\\22\\5C\\FF\"", oss.str().c_str());
@@ -67,19 +67,19 @@
char x[3] = { 'a', 'b', 'c' };
char y[3] = { '1', '2', '3' };
- MDString *s1 = MDString::get(&x[0], &x[3]);
- MDString *s2 = MDString::get(&y[0], &y[3]);
- ConstantInt *CI = ConstantInt::get(APInt(8, 0));
+ MDString *s1 = getGlobalContext().getMDString(&x[0], &x[3]);
+ MDString *s2 = getGlobalContext().getMDString(&y[0], &y[3]);
+ ConstantInt *CI = getGlobalContext().getConstantInt(APInt(8, 0));
std::vector<Value *> V;
V.push_back(s1);
V.push_back(CI);
V.push_back(s2);
- MDNode *n1 = MDNode::get(&V[0], 3);
+ MDNode *n1 = getGlobalContext().getMDNode(&V[0], 3);
Value *const c1 = n1;
- MDNode *n2 = MDNode::get(&c1, 1);
- MDNode *n3 = MDNode::get(&V[0], 3);
+ MDNode *n2 = getGlobalContext().getMDNode(&c1, 1);
+ MDNode *n3 = getGlobalContext().getMDNode(&V[0], 3);
EXPECT_NE(n1, n2);
EXPECT_EQ(n1, n3);
@@ -102,15 +102,15 @@
}
TEST(MDNodeTest, RAUW) {
- Constant *C = ConstantInt::get(Type::Int32Ty, 1);
+ Constant *C = getGlobalContext().getConstantInt(Type::Int32Ty, 1);
Instruction *I = new BitCastInst(C, Type::Int32Ty);
Value *const V1 = I;
- MDNode *n1 = MDNode::get(&V1, 1);
+ MDNode *n1 = getGlobalContext().getMDNode(&V1, 1);
WeakVH wn1 = n1;
Value *const V2 = C;
- MDNode *n2 = MDNode::get(&V2, 1);
+ MDNode *n2 = getGlobalContext().getMDNode(&V2, 1);
WeakVH wn2 = n2;
EXPECT_NE(wn1, wn2);
@@ -121,11 +121,11 @@
}
TEST(MDNodeTest, Delete) {
- Constant *C = ConstantInt::get(Type::Int32Ty, 1);
+ Constant *C = getGlobalContext().getConstantInt(Type::Int32Ty, 1);
Instruction *I = new BitCastInst(C, Type::Int32Ty);
Value *const V = I;
- MDNode *n = MDNode::get(&V, 1);
+ MDNode *n = getGlobalContext().getMDNode(&V, 1);
WeakVH wvh = n;
EXPECT_EQ(n, wvh);