]> granicus.if.org Git - clang/commit
[ObjC][Sema] Avoid warning about a call to an instance method on an
authorAlex Lorenz <arphaman@gmail.com>
Wed, 15 Mar 2017 17:16:41 +0000 (17:16 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 15 Mar 2017 17:16:41 +0000 (17:16 +0000)
commitbd0f432820aba8666db2a736d7fc719e2b803b9f
treee3fb554bdff70786e000117eec90d5ff7857c62b
parent09d53961867c7e5ea760ff11d88763553eb1c878
[ObjC][Sema] Avoid warning about a call to an instance method on an
instance of a qualified Class object when that instance method comes from
a protocol that's implemented by NSObject

Instance methods from a root class like NSObject are also class methods because
the metaclass of root class derives from that root class. Therefore, we can
avoid the warning for instances of qualified Class objects that point to classes
that derive from NSObject. Note that we actually don't know if a Class instance
points to a class that derives from NSObject at compile-time, so we have to
make a reasonable assumption that the majority of instances will do so.

rdar://22812517

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297862 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaExprObjC.cpp
test/SemaObjC/class-message-protocol-lookup.m