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/SemaLambda.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/SemaLambda.cpp')
-rw-r--r-- | lib/Sema/SemaLambda.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index 19d2de7197..db8dd1793c 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -1388,8 +1388,9 @@ static void addBlockPointerConversion(Sema &S, Class->addDecl(Conversion); } -static ExprResult performLambdaVarCaptureInitialization( - Sema &S, const LambdaScopeInfo::Capture &Capture, FieldDecl *Field) { +static ExprResult performLambdaVarCaptureInitialization(Sema &S, + const Capture &Capture, + FieldDecl *Field) { assert(Capture.isVariableCapture() && "not a variable capture"); auto *Var = Capture.getVariable(); @@ -1443,7 +1444,7 @@ mapImplicitCaptureStyle(CapturingScopeInfo::ImplicitCaptureStyle ICS) { llvm_unreachable("Unknown implicit capture style"); } -bool Sema::CaptureHasSideEffects(const LambdaScopeInfo::Capture &From) { +bool Sema::CaptureHasSideEffects(const Capture &From) { if (!From.isVLATypeCapture()) { Expr *Init = From.getInitExpr(); if (Init && Init->HasSideEffects(Context)) @@ -1468,7 +1469,7 @@ bool Sema::CaptureHasSideEffects(const LambdaScopeInfo::Capture &From) { return false; } -void Sema::DiagnoseUnusedLambdaCapture(const LambdaScopeInfo::Capture &From) { +void Sema::DiagnoseUnusedLambdaCapture(const Capture &From) { if (CaptureHasSideEffects(From)) return; @@ -1523,7 +1524,7 @@ ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, // Translate captures. auto CurField = Class->field_begin(); for (unsigned I = 0, N = LSI->Captures.size(); I != N; ++I, ++CurField) { - const LambdaScopeInfo::Capture &From = LSI->Captures[I]; + const Capture &From = LSI->Captures[I]; assert(!From.isBlockCapture() && "Cannot capture __block variables"); bool IsImplicit = I >= LSI->NumExplicitCaptures; |