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

Stephane Moore via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 14:18:33 PDT 2022


stephanemoore accepted this revision.
stephanemoore added inline comments.


================
Comment at: clang/lib/CodeGen/CGObjC.cpp:1194-1196
+      // emitted for it to be passed to the property helper. Since the `_cmd`
+      // argument was never being initialized by the caller before, still pass
+      // an uninitialized/undefined value here.
----------------
Thanks for matching the previous behavior 👌


================
Comment at: clang/lib/CodeGen/CGObjC.cpp:1493
+    llvm::Value *cmd = Builder.CreateLoad(GetAddrOfLocalVar(setterMethod->getCmdDecl()),
+                               "cmd");
+    llvm::Value *self = Builder.CreateBitCast(LoadObjCSelf(), VoidPtrTy);
----------------
Previously this was using the default "" for the `Name` instead of "cmd".

I can't think of why it would intentionally want to use "". Using "cmd" is consistent with the codegen for the getter (now and before) so I don't disagree with using "cmd" for the name here.


================
Comment at: clang/lib/CodeGen/CGObjC.cpp:1494
+                               "cmd");
+    llvm::Value *self = Builder.CreateBitCast(LoadObjCSelf(), VoidPtrTy);
     llvm::Value *ivarOffset =
----------------
Strictly speaking, I think we can leave this line untouched now?


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

https://reviews.llvm.org/D135091



More information about the cfe-commits mailing list