diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-02-06 23:46:08 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-02-06 23:46:08 +0000 |
commit | bf21cacef11f7d6db97b7acc4c0e83f28098462a (patch) | |
tree | 4ec50b51089c17f191363e27383518b7413f8e4b /clang/lib/CodeGen | |
parent | 5470205ad292f9603aec0a9e9da26faf4143aa4b (diff) | |
download | bcm5719-llvm-bf21cacef11f7d6db97b7acc4c0e83f28098462a.tar.gz bcm5719-llvm-bf21cacef11f7d6db97b7acc4c0e83f28098462a.zip |
Don't recalculate the size of the array each time through the for-loop.
llvm-svn: 149933
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index b3bb0cc2072..f0b20c319a9 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/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); |