arphaman added a comment.

In https://reviews.llvm.org/D30174#681801, @ahatanak wrote:

> Do we still issue a warning even when the struct can be returned in a 
> register? For example, x86 can return a small struct (for example, a struct 
> with one int field) in a single register, in which case it's fine to pass it 
> to performSelector via @selector.


Yes, we do. Primarily for the following reason: even if some target may return 
a struct in a register, another target isn't guaranteed to do the same thing. 
It's better to always warn about this rather than accept some small structs. 
Furthermore, the official documentation states that "For methods that return 
anything other than an object, use NSInvocation." [1], so methods that return 
records are completely prohibited by the docs.

> If we should warn only when the method has to return via sret, then it looks 
> like we have to delay issuing the warning until we know where the return 
> value goes (IRGen?).

[1] 
https://developer.apple.com/reference/objectivec/1418956-nsobject/1418867-performselector?language=objc


Repository:
  rL LLVM

https://reviews.llvm.org/D30174



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to