Only warn for mismatched types in Objective-C methods when they are incompatible, not when they are simply different.  Now we test whether the difference in types breaks the principle of substitutability, rather than whether they are different.

A common idiom in Objective-C is to provide a definition of a method in a subclass that returns a more-specified version of an object than the superclass.  This does not violate the principle of substitutability, because you can always use the object returned by the subclass anywhere that you could use the type returned by the superclass.  It was, however, generating warnings with clang, leading people to believe that semantically correct code was incorrect and requiring less accurate type specification and explicit down-casts (neither of which is a good thing to encourage).

This change ensures that any method definition has parameter and return types that make it accept anything that something conforming to the declaration may pass and return something that the caller will expect, but allows stricter definitions.  



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117271 91177308-0d34-0410-b5e6-96231b3b80d8
4 files changed