diff options
author | Reid Kleckner <rnk@google.com> | 2018-03-07 22:48:35 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-03-07 22:48:35 +0000 |
commit | 1f5fca8f18e3417de286e5bdb7ef06ef3ebb4db4 (patch) | |
tree | c4312a29ce81cab1f47b2c1267f963c9476b723f /lib/Sema/SemaStmt.cpp | |
parent | 9062e07a82f72a8bf3f55701a6b1f26186eb74a0 (diff) | |
download | clang-1f5fca8f18e3417de286e5bdb7ef06ef3ebb4db4.tar.gz |
Avoid including ScopeInfo.h from Sema.h
Summary:
This provides no measurable build speedup, but it reinstates an
optimization from r112038 that was lost in r179618. It requires moving
CapturedScopeInfo::Capture out to clang::sema, which might be too
general since we have plenty of other Capture records in BlockDecl and
other AST nodes.
Reviewers: rjmccall
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D44221
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326957 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index b77018503a..08af3fa676 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -4040,32 +4040,29 @@ Sema::CreateCapturedStmtRecordDecl(CapturedDecl *&CD, SourceLocation Loc, return RD; } -static void buildCapturedStmtCaptureList( - SmallVectorImpl<CapturedStmt::Capture> &Captures, - SmallVectorImpl<Expr *> &CaptureInits, - ArrayRef<CapturingScopeInfo::Capture> Candidates) { - - typedef ArrayRef<CapturingScopeInfo::Capture>::const_iterator CaptureIter; - for (CaptureIter Cap = Candidates.begin(); Cap != Candidates.end(); ++Cap) { - - if (Cap->isThisCapture()) { - Captures.push_back(CapturedStmt::Capture(Cap->getLocation(), +static void +buildCapturedStmtCaptureList(SmallVectorImpl<CapturedStmt::Capture> &Captures, + SmallVectorImpl<Expr *> &CaptureInits, + ArrayRef<sema::Capture> Candidates) { + for (const sema::Capture &Cap : Candidates) { + if (Cap.isThisCapture()) { + Captures.push_back(CapturedStmt::Capture(Cap.getLocation(), CapturedStmt::VCK_This)); - CaptureInits.push_back(Cap->getInitExpr()); + CaptureInits.push_back(Cap.getInitExpr()); continue; - } else if (Cap->isVLATypeCapture()) { + } else if (Cap.isVLATypeCapture()) { Captures.push_back( - CapturedStmt::Capture(Cap->getLocation(), CapturedStmt::VCK_VLAType)); + CapturedStmt::Capture(Cap.getLocation(), CapturedStmt::VCK_VLAType)); CaptureInits.push_back(nullptr); continue; } - Captures.push_back(CapturedStmt::Capture(Cap->getLocation(), - Cap->isReferenceCapture() + Captures.push_back(CapturedStmt::Capture(Cap.getLocation(), + Cap.isReferenceCapture() ? CapturedStmt::VCK_ByRef : CapturedStmt::VCK_ByCopy, - Cap->getVariable())); - CaptureInits.push_back(Cap->getInitExpr()); + Cap.getVariable())); + CaptureInits.push_back(Cap.getInitExpr()); } } |