aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-08-05 23:16:16 +0000
committerOwen Anderson <resistor@mac.com>2009-08-05 23:16:16 +0000
commitd7f2a6cb3fbc012763adb42fd967f6fefbb22a37 (patch)
tree0a2846e2b735aa45cedaa4266ffaa62786d07541 /lib/VMCore/Constants.cpp
parent70cd88fb7b5b77f8bbca7417e624d11b6e22a7e7 (diff)
downloadexternal_llvm-d7f2a6cb3fbc012763adb42fd967f6fefbb22a37.zip
external_llvm-d7f2a6cb3fbc012763adb42fd967f6fefbb22a37.tar.gz
external_llvm-d7f2a6cb3fbc012763adb42fd967f6fefbb22a37.tar.bz2
Privatize the StructType table, which unfortunately involves routing contexts through a number of APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78258 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r--lib/VMCore/Constants.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index d5f3eb9..161afe4 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -532,18 +532,20 @@ Constant* ConstantStruct::get(const StructType* T,
return ConstantAggregateZero::get(T);
}
-Constant* ConstantStruct::get(const std::vector<Constant*>& V, bool packed) {
+Constant* ConstantStruct::get(LLVMContext &Context,
+ const std::vector<Constant*>& V, bool packed) {
std::vector<const Type*> StructEls;
StructEls.reserve(V.size());
for (unsigned i = 0, e = V.size(); i != e; ++i)
StructEls.push_back(V[i]->getType());
- return get(StructType::get(StructEls, packed), V);
+ return get(StructType::get(Context, StructEls, packed), V);
}
-Constant* ConstantStruct::get(Constant* const *Vals, unsigned NumVals,
+Constant* ConstantStruct::get(LLVMContext &Context,
+ Constant* const *Vals, unsigned NumVals,
bool Packed) {
// FIXME: make this the primary ctor method.
- return get(std::vector<Constant*>(Vals, Vals+NumVals), Packed);
+ return get(Context, std::vector<Constant*>(Vals, Vals+NumVals), Packed);
}
ConstantVector::ConstantVector(const VectorType *T,
@@ -1355,7 +1357,8 @@ Constant* ConstantExpr::getSizeOf(const Type* Ty) {
Constant* ConstantExpr::getAlignOf(const Type* Ty) {
// alignof is implemented as: (i64) gep ({i8,Ty}*)null, 0, 1
- const Type *AligningTy = StructType::get(Type::Int8Ty, Ty, NULL);
+ const Type *AligningTy = StructType::get(Ty->getContext(),
+ Type::Int8Ty, Ty, NULL);
Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo());
Constant *Zero = ConstantInt::get(Type::Int32Ty, 0);
Constant *One = ConstantInt::get(Type::Int32Ty, 1);