[PATCH] D19536: [CodeGenObjCXX] Fix handling of blocks in lambda

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Mon May 2 15:35:20 PDT 2016


ahatanak added inline comments.

================
Comment at: lib/CodeGen/CGBlocks.cpp:806
@@ -792,1 +805,3 @@
+      }
+      src = Builder.CreateStructGEP(Addr, Idx, Offset, FD->getName());
     } else {
----------------
rjmccall wrote:
> 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();
>   }
Seems like a lot of regression tests fail if I try the code above. Currently investigating.


http://reviews.llvm.org/D19536





More information about the cfe-commits mailing list