diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-03-06 15:58:34 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-03-06 15:58:34 +0000 |
commit | c8cd8ea2c4d72a30cbe61f83c16d17a52f9937cc (patch) | |
tree | 8c2ada9e45dc0a085336baed1a8016d1f7f8164e /include/clang/Basic/DiagnosticSemaKinds.td | |
parent | 879a2c4c5e8c11a0fab7c346212c39eaee3da9a6 (diff) |
[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
Diffstat (limited to 'include/clang/Basic/DiagnosticSemaKinds.td')
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 86a445ba4a..54aa1f1481 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -6016,6 +6016,12 @@ def warn_objc_circular_container : Warning< "adding '%0' to '%1' might cause circular dependency in container">, InGroup<DiagGroup<"objc-circular-container">>; def note_objc_circular_container_declared_here : Note<"'%0' declared here">; +def warn_objc_unsafe_perform_selector : Warning< + "%0 is incompatible with selectors that return a " + "%select{struct|union|vector}1 type">, + InGroup<DiagGroup<"objc-unsafe-perform-selector">>; +def note_objc_unsafe_perform_selector_method_declared_here : Note< + "method %0 that returns %1 declared here">; def warn_setter_getter_impl_required : Warning< "property %0 requires method %1 to be defined - " |