aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-02-06 23:46:08 +0000
committerBill Wendling <isanbard@gmail.com>2012-02-06 23:46:08 +0000
commitfd3e5ef640df089a1e717097cdb599eb9dd32ec4 (patch)
tree71cf6ec7057a252ff152718f7abed3bbba5b9b87 /lib/CodeGen/CGExprConstant.cpp
parente97c58d1f64fca38055deb6669b55f90ae8890ca (diff)
Don't recalculate the size of the array each time through the for-loop.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149933 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--lib/CodeGen/CGExprConstant.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index b3bb0cc207..f0b20c319a 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -727,7 +727,7 @@ public:
if (RewriteType) {
// FIXME: Try to avoid packing the array
std::vector<llvm::Type*> Types;
- for (unsigned i = 0; i < Elts.size(); ++i)
+ for (unsigned i = 0, e = Elts.size(); i < e; ++i)
Types.push_back(Elts[i]->getType());
llvm::StructType *SType = llvm::StructType::get(AType->getContext(),
Types, true);
@@ -1132,7 +1132,7 @@ llvm::Constant *CodeGenModule::EmitConstantValue(const APValue &Value,
if (!CommonElementType) {
// FIXME: Try to avoid packing the array
std::vector<llvm::Type*> Types;
- for (unsigned i = 0; i < Elts.size(); ++i)
+ for (unsigned i = 0, e = Elts.size(); i < e; ++i)
Types.push_back(Elts[i]->getType());
llvm::StructType *SType = llvm::StructType::get(VMContext, Types, true);
return llvm::ConstantStruct::get(SType, Elts);