Remove the unused/undefined `_cmd` parameter in `objc_direct` methods.
authorMichael Wyman <michael@mwyman.com>
Wed, 14 Sep 2022 21:42:30 +0000 (14:42 -0700)
committerMichael Wyman <michael@mwyman.com>
Wed, 21 Sep 2022 22:37:48 +0000 (15:37 -0700)
commitaa4bcaab9600b42165587ec6f135399ff933bd14
treeefd436432f1c42e60708e191d5831e9c7d77f91a
parent1d8a7adca6afa479d2913189631d941e0b084825
Remove the unused/undefined `_cmd` parameter in `objc_direct` methods.

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.

Differential Revision: https://reviews.llvm.org/D131424
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CGObjC.cpp
clang/lib/CodeGen/CGObjCMac.cpp
clang/test/CodeGenObjC/direct-method.m