<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi John,<div><br></div><div>This test case:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">id test_dict()</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">{</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">        return @{</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">                @"a": [](){},</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">                @"b": [](){}</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">        };</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">}</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Crashes in IRGen because ExprWithCleanups for the dummy BlockDecl we use to facilitate lambda to block conversion</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">is at the wrong place.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">This happens because a lambda expression is considered a full expression so it calls MaybeCreateExprWithCleanups</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">(see <span style="color: rgb(79, 129, 135);">Sema</span>::BuildBlockForLambdaConversion).</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">which ends up adding the clean up code for the BlockDecl of the first lambda to the expression for the 2nd lambda!</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Ideally, MaybeCreateExprWithCleanups should be called when the entire dictionary literal is seen. But in this case,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">this does not happen. Attached patch fixes this by making sure that after ‘every’ parse of the ‘value’ expression</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">MaybeCreateExprWithCleanups is called. This, in effect, assumes that the ‘value’ literal is a full expression.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">I don’t know the ramification of this change in the common case as couple of non-lambda literal tests broke.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">(it now generates the none-exc version of call instead of exc versions in couple of places).</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Please review. Let me know if you need additional info.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">- Thanks, Fariborz</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"></div></body></html>