]> granicus.if.org Git - clang/commit
[analyzer] Don't track retain counts of objects directly accessed through ivars.
authorJordan Rose <jordan_rose@apple.com>
Tue, 25 Mar 2014 17:10:58 +0000 (17:10 +0000)
committerJordan Rose <jordan_rose@apple.com>
Tue, 25 Mar 2014 17:10:58 +0000 (17:10 +0000)
commitfa9f141c711c12da0d052bc31854781d590e6b6f
treec3de635be17377aac54fd42a9a426d15d955b08a
parentd13c37832fb3792e1a05352184cb7b73e9fc8a93
[analyzer] Don't track retain counts of objects directly accessed through ivars.

A refinement of r198953 to handle cases where an object is accessed both through
a property getter and through direct ivar access. An object accessed through a
property should always be treated as +0, i.e. not owned by the caller. However,
an object accessed through an ivar may be at +0 or at +1, depending on whether
the ivar is a strong reference. Outside of ARC, we don't have that information,
so we just don't track objects accessed through ivars.

With this change, accessing an ivar directly will deliberately override the +0
provided by a getter, but only if the +0 hasn't participated in other retain
counting yet. That isn't perfect, but it's already unusual for people to be
mixing property access with direct ivar access. (The primary use case for this
is in setters, init methods, and -dealloc.)

Thanks to Ted for spotting a few mistakes in private review.

<rdar://problem/16333368>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204730 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
test/Analysis/properties.m