]> granicus.if.org Git - clang/commit
[analyzer] ObjCDeallocChecker: Only operate on classes with retained properties.
authorDevin Coughlin <dcoughlin@apple.com>
Wed, 27 Jan 2016 01:41:58 +0000 (01:41 +0000)
committerDevin Coughlin <dcoughlin@apple.com>
Wed, 27 Jan 2016 01:41:58 +0000 (01:41 +0000)
commite8acae8d65b63937e237511d72f2243d930afb44
tree930bf1e019f3dc33d7560edd3d367a722ff47760
parent9030f4d6bd1ea0d27354c65c1b7c450c73a01667
[analyzer] ObjCDeallocChecker: Only operate on classes with retained properties.

Previously the ObjC Dealloc Checker only checked classes with ivars, not
retained properties, which caused three bugs:

- False positive warnings about a missing -dealloc method in classes with only
ivars.
- Missing warnings about a missing -dealloc method on classes with only
properties.
- Missing warnings about an over-released or under-released ivar associated with
a retained property in classes with only properties.

The fix is to check only classes with at least one retained synthesized
property.

This also exposed a bug when reporting an over-released or under-released
property that did not contain a synthesize statement. The checker tried to
associate the warning with an @synthesize statement that did not exist, which
caused an assertion failure in debug builds. The fix is to fall back to the
@property statement in this case.

A patch by David Kilzer!

Part of rdar://problem/6927496

Differential Revision: http://reviews.llvm.org/D5023

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258896 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
test/Analysis/DeallocMissingRelease.m [new file with mode: 0644]
test/Analysis/MissingDealloc.m
test/Analysis/PR2978.m