]> granicus.if.org Git - clang/commit
[Sema][ObjC] Warn about 'performSelector' calls with selectors
authorAlex Lorenz <arphaman@gmail.com>
Mon, 6 Mar 2017 15:58:34 +0000 (15:58 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Mon, 6 Mar 2017 15:58:34 +0000 (15:58 +0000)
commitc8cd8ea2c4d72a30cbe61f83c16d17a52f9937cc
tree8c2ada9e45dc0a085336baed1a8016d1f7f8164e
parent879a2c4c5e8c11a0fab7c346212c39eaee3da9a6
[Sema][ObjC] Warn about 'performSelector' calls with selectors
that return record or vector types

The performSelector family of methods from Foundation use objc_msgSend to
dispatch the selector invocations to objects. However, method calls to methods
that return record types might have to use the objc_msgSend_stret as the return
value won't find into the register. This is also supported by this sentence from
performSelector documentation: "The method should not have a significant return
value and should take a single argument of type id, or no arguments". This
commit adds a new warning that warns when a selector which corresponds to a
method that returns a record type is passed into performSelector.

rdar://12056271

Differential Revision: https://reviews.llvm.org/D30174

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297019 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/AST/DeclObjC.cpp
lib/Basic/IdentifierTable.cpp
lib/Sema/SemaExprObjC.cpp
test/SemaObjC/unsafe-perform-selector.m [new file with mode: 0644]