forked from OSchip/llvm-project
[C++11] Replacing CXXRecordDecl 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: 203817
This commit is contained in:
parent
a316933e09
commit
6def98ab5f
|
@ -1019,6 +1019,11 @@ public:
|
|||
FieldDecl *&ThisCapture) const;
|
||||
|
||||
typedef const LambdaExpr::Capture* capture_const_iterator;
|
||||
typedef llvm::iterator_range<capture_const_iterator> capture_const_range;
|
||||
|
||||
capture_const_range captures() const {
|
||||
return capture_const_range(captures_begin(), captures_end());
|
||||
}
|
||||
capture_const_iterator captures_begin() const {
|
||||
return isLambda() ? getLambdaData().Captures : NULL;
|
||||
}
|
||||
|
|
|
@ -9470,22 +9470,21 @@ static void RebuildLambdaScopeInfo(CXXMethodDecl *CallOperator,
|
|||
|
||||
// Add the captures to the LSI so they can be noted as already
|
||||
// captured within tryCaptureVar.
|
||||
for (LambdaExpr::capture_iterator C = LambdaClass->captures_begin(),
|
||||
CEnd = LambdaClass->captures_end(); C != CEnd; ++C) {
|
||||
if (C->capturesVariable()) {
|
||||
VarDecl *VD = C->getCapturedVar();
|
||||
for (const auto &C : LambdaClass->captures()) {
|
||||
if (C.capturesVariable()) {
|
||||
VarDecl *VD = C.getCapturedVar();
|
||||
if (VD->isInitCapture())
|
||||
S.CurrentInstantiationScope->InstantiatedLocal(VD, VD);
|
||||
QualType CaptureType = VD->getType();
|
||||
const bool ByRef = C->getCaptureKind() == LCK_ByRef;
|
||||
const bool ByRef = C.getCaptureKind() == LCK_ByRef;
|
||||
LSI->addCapture(VD, /*IsBlock*/false, ByRef,
|
||||
/*RefersToEnclosingLocal*/true, C->getLocation(),
|
||||
/*EllipsisLoc*/C->isPackExpansion()
|
||||
? C->getEllipsisLoc() : SourceLocation(),
|
||||
/*RefersToEnclosingLocal*/true, C.getLocation(),
|
||||
/*EllipsisLoc*/C.isPackExpansion()
|
||||
? C.getEllipsisLoc() : SourceLocation(),
|
||||
CaptureType, /*Expr*/ 0);
|
||||
|
||||
} else if (C->capturesThis()) {
|
||||
LSI->addThisCapture(/*Nested*/ false, C->getLocation(),
|
||||
} else if (C.capturesThis()) {
|
||||
LSI->addThisCapture(/*Nested*/ false, C.getLocation(),
|
||||
S.getCurrentThisType(), /*Expr*/ 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue