]> granicus.if.org Git - clang/commit
[Sema] Remove location from implicit capture init expr
authorVedant Kumar <vsk@apple.com>
Thu, 13 Sep 2018 23:28:25 +0000 (23:28 +0000)
committerVedant Kumar <vsk@apple.com>
Thu, 13 Sep 2018 23:28:25 +0000 (23:28 +0000)
commitd4e462f6541fec1c58aba92c5ef538821feef4f6
tree62e543d9125ea37b0ad6fc075ec56f7b436c5f8a
parentb50bc3665d6b9751917b923e89bd21e92e1206ba
[Sema] Remove location from implicit capture init expr

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 the starting location of the lambda
to expressions which initialize an implicit capture within it.

rdar://39807527

Differential Revision: https://reviews.llvm.org/D50927

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342194 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaLambda.cpp
test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp
test/CodeGenCXX/debug-info-lambda.cpp [new file with mode: 0644]
test/SemaCXX/uninitialized.cpp
unittests/Tooling/RecursiveASTVisitorTests/DeclRefExpr.cpp