Page MenuHomePhabricator

Replace the broken LambdaCapture::isInitCapture API.
ClosedPublic

Authored by jdennett on May 4 2015, 12:45 PM.

Details

Reviewers
rsmith
Summary

A LambdaCapture does not have sufficient information
to correctly determine whether it is an init-capture or not.
Doing so requires knowledge held in the LambdaExpr itself.

It the case of a nested capture of an init-capture it is not
sufficient to check (as LambdaCapture::isInitCapture
did) whether the associated VarDecl was from an init-capture.

This patch moves isInitCapture to the LambdaExpr and updates
capture->isInitCapture() to lambda->isInitCapture(capture).

Diff Detail

Event Timeline

jdennett updated this revision to Diff 24907.May 4 2015, 12:45 PM
jdennett retitled this revision from to Replace the broken LambdaCapture::isInitCapture API..
jdennett updated this object.
jdennett edited the test plan for this revision. (Show Details)
jdennett updated this object.May 4 2015, 12:48 PM
jdennett added a subscriber: Unknown Object (MLST).
jdennett updated this revision to Diff 24980.May 5 2015, 2:26 PM

Added tests, and fixed the fix.

Clang ToT rejects the (valid) code from the testcase. With this patch,
it is accepted (and works as intended).

jdennett updated this revision to Diff 24981.May 5 2015, 2:27 PM

Actually add the test.

jdennett updated this revision to Diff 24982.May 5 2015, 2:28 PM

Coding style fix: change parameter name from capture to Capture.

jdennett updated this revision to Diff 24984.May 5 2015, 2:46 PM

Fixing formatting.

rsmith accepted this revision.May 7 2015, 9:43 AM
rsmith edited edge metadata.

LGTM

This revision is now accepted and ready to land.May 7 2015, 9:43 AM
jdennett updated this revision to Diff 27565.Jun 11 2015, 10:52 PM
jdennett edited edge metadata.

Improve formatting of lambda functions.

Don't let the trailing '*' of a lambda's explicitly-specified return
type be immediately adjacent to the left brace that starts the body
of the lambda.

jdennett closed this revision.Jun 11 2015, 11:04 PM

That last patch was me losing a fight with arc. The clang-format patch is http://reviews.llvm.org/D10410. This one really is closed.