[PATCH] D131424: Remove the unused/undefined _cmd parameter to objc_direct methods.

Michael Wyman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 8 12:12:30 PDT 2022


mwyman created this revision.
mwyman added reviewers: dmaclach, plotfi.
mwyman added a project: clang.
Herald added a project: All.
mwyman requested review of this revision.
Herald added a subscriber: cfe-commits.

When `objc_direct` methods were implemented, the implicit `_cmd` parameter was left as an argument to the method implementation function, but was unset by callers; if the method body referenced the `_cmd` variable, a selector load would be emitted inside the body. However, this leaves an unused argument in the ABI, and is unnecessary.

This change removes the empty/unset argument, and if `_cmd` is referenced inside an `objc_direct` method it will emit local storage for the implicit variable. From the ABI perspective, `objc_direct` methods will have the implicit `self` parameter, immediately followed by whatever explicit arguments are defined on the method, rather than having one unset/undefined register in the middle.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131424

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCMac.cpp
  clang/test/CodeGenObjC/direct-method.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131424.450899.patch
Type: text/x-patch
Size: 6061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220808/c27ce718/attachment-0001.bin>


More information about the cfe-commits mailing list