[objc_direct] fix codegen for mismatched Decl/Impl return types
authorPierre Habouzit <phabouzit@apple.com>
Wed, 22 Jan 2020 16:46:54 +0000 (08:46 -0800)
committerPierre Habouzit <phabouzit@apple.com>
Fri, 31 Jan 2020 02:17:45 +0000 (18:17 -0800)
commit6eb969b7c5b5195d7f85b70e2e060eb2989cdc3c
tree9eed1ab2cc64ce2278ce73365f9df7eafea04391
parent31905c2bbb80f79366d92fc6426818fb20896659
[objc_direct] fix codegen for mismatched Decl/Impl return types

For non direct methods, the codegen uses the type of the Implementation.
Because Objective-C rules allow some differences between the Declaration
and Implementation return types, when the Implementation is in this
translation unit, the type of the Implementation should be preferred to
emit the Function over the Declaration.

Radar-Id: rdar://problem/58797748
Signed-off-by: Pierre Habouzit <phabouzit@apple.com>
Differential Revision: https://reviews.llvm.org/D73208
clang/lib/CodeGen/CGObjCMac.cpp
clang/test/CodeGenObjC/direct-method-ret-mismatch.m [new file with mode: 0644]