diff options
author | Jordan Rose <jordan_rose@apple.com> | 2015-02-04 19:24:52 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2015-02-04 19:24:52 +0000 |
commit | cb5386cbfc6bc80ee0bfd37e27bcf238edcd9836 (patch) | |
tree | b577541563a68a66491ac09350eda132c9a7b4cc /clang/lib/Analysis/ThreadSafety.cpp | |
parent | c26a17a822bb91084ce29a97ba01dfcf7f2e5074 (diff) | |
download | llvm-cb5386cbfc6bc80ee0bfd37e27bcf238edcd9836.zip llvm-cb5386cbfc6bc80ee0bfd37e27bcf238edcd9836.tar.gz llvm-cb5386cbfc6bc80ee0bfd37e27bcf238edcd9836.tar.bz2 |
[analyzer] RetainCountChecker: be forgiving when ivars are accessed directly.
A refinement of r204730, itself a refinement of r198953, to better 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 always have that
information.
The previous attempt would clear out the +0 provided by a getter, but only
if that +0 hadn't already participated in other retain counting operations.
(That is, "self.foo" is okay, but "[[self.foo retain] autorelease]" is
problematic.) This turned out to not be good enough when our synthesized
getters get involved.
This commit drops the notion of "overridable" reference counting and instead
just tracks whether a value ever came from a (strong) ivar. If it has, we
allow one more release than we otherwise would. This has the added benefit
of being able to catch /some/ overreleases of instance variables, though
it's not likely to come up in practice.
We do still get some false negatives because we currently throw away
refcount state upon assigning a value into an ivar. We should probably
improve on that in the future, especially once we synthesize setters as
well as getters.
rdar://problem/18075108
llvm-svn: 228174
Diffstat (limited to 'clang/lib/Analysis/ThreadSafety.cpp')
0 files changed, 0 insertions, 0 deletions