[PATCH] D135091: Create storage for the `_cmd` argument to the helper function for generated getters/setters of `direct` Objective-C properties.

Puyan Lotfi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 14:49:16 PDT 2022


plotfi added a comment.

LGTM but waiting on Akira would be nice imho.



================
Comment at: clang/lib/CodeGen/CGObjC.cpp:1192
     // corresponding gcc code.
-    llvm::Value *cmd =
-      Builder.CreateLoad(GetAddrOfLocalVar(getterMethod->getCmdDecl()), "cmd");
+    if (getterMethod->isDirectMethod()) {
+      // Direct methods no longer have a `_cmd` argument, so storage must be
----------------
Could this entire code sequence be moved to a helper or helper method? I think it could be good if the _cmd argument emission and the associated code comments were only written once. 


================
Comment at: clang/lib/CodeGen/CGObjC.cpp:1485
     //                       <is-atomic>, <is-copy>).
-    llvm::Value *cmd =
-      Builder.CreateLoad(GetAddrOfLocalVar(setterMethod->getCmdDecl()));
-    llvm::Value *self =
-      Builder.CreateBitCast(LoadObjCSelf(), VoidPtrTy);
+    if (setterMethod->isDirectMethod()) {
+      // Direct methods no longer have a `_cmd` argument, so storage must be
----------------
Ditto


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

https://reviews.llvm.org/D135091



More information about the cfe-commits mailing list