implement new helper method
authorChris Lattner <sabre@nondot.org>
Mon, 12 Jul 2004 20:35:11 +0000 (20:35 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 12 Jul 2004 20:35:11 +0000 (20:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14776 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Constants.cpp

index c8e59609e9e2cfc0d72ba6335b4641a31a2501ee..6a547e05ae3cadc0af6c6bd491a6578956e56529 100644 (file)
@@ -997,6 +997,14 @@ Constant *ConstantStruct::get(const StructType *Ty,
   return ConstantAggregateZero::get(Ty);
 }
 
+Constant *ConstantStruct::get(const std::vector<Constant*> &V) {
+  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), V);
+}
+
 // destroyConstant - Remove the constant from the constant table...
 //
 void ConstantStruct::destroyConstant() {