diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-14 18:34:04 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-14 18:34:04 +0000 |
commit | 9371dd2287d35b63193f1f01329e6f7af368d966 (patch) | |
tree | a5774aa255e93ba82568bb564b389ef8fc0cd4f8 /clang/lib/CodeGen/CGObjCMac.cpp | |
parent | 84e0723af89eeea211cfd9fce7edf0cbb70ca483 (diff) | |
download | bcm5719-llvm-9371dd2287d35b63193f1f01329e6f7af368d966.tar.gz bcm5719-llvm-9371dd2287d35b63193f1f01329e6f7af368d966.zip |
[C++11] Replacing BlockDecl iterators capture_begin() and capture_end() with iterator_range captures(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203958
Diffstat (limited to 'clang/lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 64b55d21c29..a1d9f181543 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -1961,9 +1961,8 @@ llvm::Constant *CGObjCCommonMac::BuildGCBlockLayout(CodeGenModule &CGM, // to be GC'ed. // Walk the captured variables. - for (BlockDecl::capture_const_iterator ci = blockDecl->capture_begin(), - ce = blockDecl->capture_end(); ci != ce; ++ci) { - const VarDecl *variable = ci->getVariable(); + for (const auto &CI : blockDecl->captures()) { + const VarDecl *variable = CI.getVariable(); QualType type = variable->getType(); const CGBlockInfo::Capture &capture = blockInfo.getCapture(variable); @@ -1974,7 +1973,7 @@ llvm::Constant *CGObjCCommonMac::BuildGCBlockLayout(CodeGenModule &CGM, uint64_t fieldOffset = layout->getElementOffset(capture.getIndex()); // __block variables are passed by their descriptor address. - if (ci->isByRef()) { + if (CI.isByRef()) { IvarsInfo.push_back(GC_IVAR(fieldOffset, /*size in words*/ 1)); continue; } @@ -2474,9 +2473,8 @@ llvm::Constant *CGObjCCommonMac::BuildRCBlockLayout(CodeGenModule &CGM, blockInfo.BlockHeaderForcedGapOffset, blockInfo.BlockHeaderForcedGapSize); // Walk the captured variables. - for (BlockDecl::capture_const_iterator ci = blockDecl->capture_begin(), - ce = blockDecl->capture_end(); ci != ce; ++ci) { - const VarDecl *variable = ci->getVariable(); + for (const auto &CI : blockDecl->captures()) { + const VarDecl *variable = CI.getVariable(); QualType type = variable->getType(); const CGBlockInfo::Capture &capture = blockInfo.getCapture(variable); @@ -2488,17 +2486,17 @@ llvm::Constant *CGObjCCommonMac::BuildRCBlockLayout(CodeGenModule &CGM, CharUnits::fromQuantity(layout->getElementOffset(capture.getIndex())); assert(!type->isArrayType() && "array variable should not be caught"); - if (!ci->isByRef()) + if (!CI.isByRef()) if (const RecordType *record = type->getAs<RecordType>()) { BuildRCBlockVarRecordLayout(record, fieldOffset, hasUnion); continue; } CharUnits fieldSize; - if (ci->isByRef()) + if (CI.isByRef()) fieldSize = CharUnits::fromQuantity(WordSizeInBytes); else fieldSize = CGM.getContext().getTypeSizeInChars(type); - UpdateRunSkipBlockVars(ci->isByRef(), getBlockCaptureLifetime(type, false), + UpdateRunSkipBlockVars(CI.isByRef(), getBlockCaptureLifetime(type, false), fieldOffset, fieldSize); } return getBitmapBlockLayout(false); |