This fixes a crash that occurs when a block nested in a c++ lambda captures a reference that is captured by the enclosing lambda.
rdar://problem/18586651
Differential D19536
[CodeGenObjCXX] Fix handling of blocks in lambda Authored by ahatanak on Apr 26 2016, 9:48 AM.
Details This fixes a crash that occurs when a block nested in a c++ lambda captures a reference that is captured by the enclosing lambda. rdar://problem/18586651
Diff Detail Event Timeline
Comment Actions Apply John's patch with a few modifications. I had to special case __block variables and remove the line creating a load from a reference to fix the failing regression tests. | ||||||||||||
Hmm. It's become increasingly clear that my original decision to expand the decl-ref logic here was a mistake. Please just turn this entire block of conditions into:
if (blockDecl->isConversionFromLambda()) { // The lambda capture in a lambda's conversion-to-block-pointer is // special; we'll simply emit it directly. src = Address::invalid(); } else { DeclRefExpr declRef( const_cast<VarDecl *>(variable), /*RefersToEnclosingVariableOrCapture*/ CI.isNested(), type, VK_LValue, SourceLocation()); src = EmitDeclRefLValue(&declRef).getAddress(); }