[PATCH] D50927: [Sema] Remove location from implicit capture init expr

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 17 14:31:22 PDT 2018


vsk created this revision.
vsk added reviewers: rsmith, rtrieu, erichkeane.

A lambda's closure is initialized when the lambda is declared. For
implicit captures, the initialization code emitted from EmitLambdaExpr
references source locations *within the lambda body* in the function
containing the lambda. This results in a poor debugging experience: we
step to the line containing the lambda, then into lambda, out again,
over and over, until every capture's field is initialized.

To improve stepping behavior, assign an empty location to expressions
which initialize an implicit capture within a closure. This prevents the
debugger from stepping into a lambda when single-stepping in its parent
function.

rdar://39807527


https://reviews.llvm.org/D50927

Files:
  clang/include/clang/AST/Expr.h
  clang/lib/AST/Expr.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaLambda.cpp
  clang/test/CodeGenCXX/debug-info-lambda.cpp
  clang/unittests/Tooling/RecursiveASTVisitorTests/DeclRefExpr.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50927.161329.patch
Type: text/x-patch
Size: 5969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180817/a962b7fc/attachment.bin>


More information about the cfe-commits mailing list