-Warc-repeated-use-of-weak: Check messages to property accessors as well.
authorJordan Rose <jordan_rose@apple.com>
Thu, 11 Oct 2012 16:06:21 +0000 (16:06 +0000)
committerJordan Rose <jordan_rose@apple.com>
Thu, 11 Oct 2012 16:06:21 +0000 (16:06 +0000)
commit224876559128e31127e236ac19a035e4ba3badf6
tree9b24c164a57bc3ce6c04f2700c932bf751b5f655
parent0db720f0dc5b62bfcde72a2761fc9793af4e4558
-Warc-repeated-use-of-weak: Check messages to property accessors as well.

Previously, [foo weakProp] was not being treated the same as foo.weakProp.
Now, for every explicit message send, we check if it's a property access,
and if so, if the property is weak. Then for every assignment of a
message, we have to do the same thing again.

This is a potentially expensive increase because determining whether a
method is a property accessor requires searching through the methods it
overrides. However, without it -Warc-repeated-use-of-weak will miss cases
from people who prefer not to use dot syntax. If this turns out to be
too expensive, we can try caching the result somewhere, or even lose
precision by not checking superclass methods. The warning is off-by-default,
though.

<rdar://problem/12407765>

llvm-svn: 165718
clang/include/clang/Sema/ScopeInfo.h
clang/lib/Sema/ScopeInfo.cpp
clang/lib/Sema/SemaExprObjC.cpp
clang/test/SemaObjC/arc-repeated-weak.mm