From 3f023d6df90f4fdc048c1148c9652eb1743dee0c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 12 Jul 2004 20:35:11 +0000 Subject: [PATCH] implement new helper method llvm-svn: 14776 --- lib/VMCore/Constants.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index c8e59609e9e..6a547e05ae3 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -997,6 +997,14 @@ Constant *ConstantStruct::get(const StructType *Ty, return ConstantAggregateZero::get(Ty); } +Constant *ConstantStruct::get(const std::vector &V) { + std::vector 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() {