HomePhabricator

Fix cleanup registration for lambda captures.

Description

Fix cleanup registration for lambda captures.

Lambda captures should be destroyed if an exception is thrown only if
the construction of the complete lambda-expression has not completed.
(If the lambda-expression has been fully constructed, any exception will
invoke its destructor, which will destroy the captures.)

This is directly modeled after how we handle the equivalent situation in
InitListExprs.

Note that EmitLambdaLValue was unreachable because in C++11 onwards the
frontend never creates the awkward situation where a prvalue expression
(such as a lambda) is used in an lvalue context (such as the left-hand
side of a class member access).

Details

Committed
rsmithJan 17 2019, 2:05 PM
Parents
rL351486: [lit] Make sure tests are actually skipped on darwin and windows.
Branches
Unknown
Tags
Unknown