diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-31 01:17:04 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-31 01:17:04 +0000 |
commit | b5a45bb77e05647f04bbd9780d70aabe9f251155 (patch) | |
tree | 1ccaf0c1585826b9245a8253bea9150801f2f46c /clang/lib/Sema/SemaStmt.cpp | |
parent | a35c50c9a4d1c15b4830c40013e73ec7933f8f6c (diff) | |
download | bcm5719-llvm-b5a45bb77e05647f04bbd9780d70aabe9f251155.tar.gz bcm5719-llvm-b5a45bb77e05647f04bbd9780d70aabe9f251155.zip |
Defer building 'this' captures until we have left the capturing region
and returned to the context in which 'this' should be captured.
This means we now always mark 'this' referenced from the context in
which it's actually referenced, rather than potentially from some
context nested within that.
llvm-svn: 362182
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 7a9a801b188..3a7acd20274 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -4235,9 +4235,11 @@ buildCapturedStmtCaptureList(Sema &S, CapturedRegionScopeInfo *RSI, FieldDecl *Field = S.BuildCaptureField(RSI->TheRecordDecl, Cap); if (Cap.isThisCapture()) { + ExprResult Init = + S.performThisCaptureInitialization(Cap, /*Implicit*/ true); Captures.push_back(CapturedStmt::Capture(Cap.getLocation(), CapturedStmt::VCK_This)); - CaptureInits.push_back(Cap.getThisInitExpr()); + CaptureInits.push_back(Init.get()); continue; } else if (Cap.isVLATypeCapture()) { Captures.push_back( @@ -4256,8 +4258,6 @@ buildCapturedStmtCaptureList(Sema &S, CapturedRegionScopeInfo *RSI, // perform a copy here! ExprResult Init = S.BuildDeclarationNameExpr( CXXScopeSpec(), DeclarationNameInfo(Var->getDeclName(), Loc), Var); - if (Init.isInvalid()) - return true; Captures.push_back(CapturedStmt::Capture(Loc, Cap.isReferenceCapture() |