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

John McCall via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 29 16:16:12 PDT 2016


rjmccall added inline comments.

================
Comment at: lib/CodeGen/CGBlocks.cpp:806
@@ -792,1 +805,3 @@
+      }
+      src = Builder.CreateStructGEP(Addr, Idx, Offset, FD->getName());
     } else {
----------------
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();
  }


http://reviews.llvm.org/D19536





More information about the cfe-commits mailing list