Change Sema::PropertyIfSetterOrGetter to make use of isPropertyAccessor.
authorJordan Rose <jordan_rose@apple.com>
Wed, 10 Oct 2012 16:42:38 +0000 (16:42 +0000)
committerJordan Rose <jordan_rose@apple.com>
Wed, 10 Oct 2012 16:42:38 +0000 (16:42 +0000)
commit79af985badfd591841abe0be09c02ffb683e1df0
treed444e092e116eb1117743752a460fb07fd537a84
parentd01e83ab3e12808ab9bd3bbc8f6b0443575684c6
Change Sema::PropertyIfSetterOrGetter to make use of isPropertyAccessor.

Old algorithm:
1. See if the name looks like a getter or setter.
2. Use the name to look up a property in the current ObjCContainer
   and all its protocols.
3. If the current container is an interface, also look in all categories
   and superclasses (and superclass categories, and so on).

New algorithm:
1. See if the method is marked as a property accessor. If so, look through
   all properties in the current container and find one that has a matching
   selector.
2. Find all overrides of the method using ObjCMethodDecl's
   getOverriddenMethods. This collects methods in superclasses and protocols
   (as well as superclass categories, which isn't really necessary), and
   checks if THEY are accessors. This part is not done recursively, since
   getOverriddenMethods is already recursive.

This lets us handle getters and setters that do not match the property
names.

llvm-svn: 165627
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaObjCProperty.cpp
clang/test/SemaObjC/property-deprecated-warning.m