[PATCH] D62643: [CodeGen][ObjC] Convert '[self alloc]' in a class method to 'objc_alloc(self)'

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 3 17:09:13 PDT 2019


erik.pilkington accepted this revision.
erik.pilkington added a comment.
This revision is now accepted and ready to land.

I thinks this looks good, aside from a null concern.



================
Comment at: lib/CodeGen/CGObjC.cpp:460
+  const Expr *SelfInClassMethod = nullptr;
+  if (const auto *CurMD = dyn_cast<ObjCMethodDecl>(CGF.CurFuncDecl))
+    if (CurMD->isClassMethod())
----------------
I think (?) that CurFuncDecl is nullable, might want to dyn_cast_or_null here. 


================
Comment at: lib/CodeGen/CGObjC.cpp:528
     ReceiverType = E->getInstanceReceiver()->getType();
+    if (auto *OMD = dyn_cast<ObjCMethodDecl>(CurFuncDecl))
+      if (OMD->isClassMethod())
----------------
(ditto)


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62643/new/

https://reviews.llvm.org/D62643





More information about the cfe-commits mailing list