diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-12 20:35:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-12 20:35:11 +0000 |
commit | b370c7a41a7bd43c4af2d7858556b25e7ac802dc (patch) | |
tree | a71aac0fae82f91f56bf53caa310cbd96a99418a /lib/VMCore/Constants.cpp | |
parent | aec6dd5bbc22187b02c893874c9755e38c50fcc0 (diff) |
implement new helper method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14776 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r-- | lib/VMCore/Constants.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index c8e59609e9..6a547e05ae 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<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() { |