Commit Graph

17 Commits

Author SHA1 Message Date
Anna Zaks 7811c3efd5 [analyzer] Invalidation checker: move the "missing implementation" check
The missing definition check should be in the same category as the
missing ivar validation - in this case, the intent is to invalidate in
the given class, as described in the declaration, but the implementation
does not perform the invalidation. Whereas the MissingInvalidationMethod
checker checks the cases where the method intention is not to
invalidate. The second checker has potential to have a much higher false
positive rate.

llvm-svn: 174787
2013-02-09 01:09:27 +00:00
Anna Zaks 91a5fdf83a [analyzer] Split IvarInvalidation into two checkers
Separate the checking for the missing invalidation methods into a
separate checker so that it can be turned on/off independently.

llvm-svn: 174781
2013-02-08 23:55:47 +00:00
Anna Zaks a5096f6f51 [analyzer] IvarInvalidation: add annotation for partial invalidation
The new annotation allows having methods that only partially invalidate
IVars and might not be called from the invalidation methods directly
(instead, are guaranteed to be called before the invalidation occurs).
The checker is going to trust the programmer to call the partial
invalidation method before the invalidator.This is common in cases when
partial object tear down happens before the death of the object.

llvm-svn: 174779
2013-02-08 23:55:43 +00:00
Anna Zaks 8a023580c7 [analyzer] Fix warning typo.
llvm-svn: 172596
2013-01-16 01:35:57 +00:00
Anna Zaks 39a7692091 [analyzer] Rename the warning: state the issue before the hint of how it
can be fixed

llvm-svn: 172170
2013-01-11 03:52:44 +00:00
Anna Zaks ca49e535ae [analyzer]Recognize ivar invalidation protocol even if it was redeclared
This will get rid of some false positives as well as false negatives.

llvm-svn: 172169
2013-01-11 03:52:40 +00:00
Anna Zaks 2975cf27e4 [analyzer] Ivar invalidation: track ivars declared in categories.
llvm-svn: 172168
2013-01-11 03:52:37 +00:00
Anna Zaks a96a9ef716 [analyzer] Allow IvarInvalidation checker to suppress warnings via
assertions.

To ensure that custom assertions/conditional would also be supported,
just check if the ivar that needs to be invalidated or set to nil is
compared against 0.

Unfortunately, this will not work for code containing 'assert(IvarName)'

llvm-svn: 172147
2013-01-10 23:34:16 +00:00
Anna Zaks 640123de5e [analyzer] Fix non-determinizm introduced in r172104.
In some cases, we just pick any ivar that needs invalidation and attach
the warning to it. Picking the first from DenseMap of pointer keys was
triggering non-deterministic output.

llvm-svn: 172134
2013-01-10 22:44:16 +00:00
Anna Zaks 0aeb60d79d [analyzer] Add more checks to the ObjC Ivar Invalidation checker.
Restructured the checker so that it could easily find two new classes of
issues:
 - when a class contains an invalidatable ivar, but no declaration of an
invalidation method
 - when a class contains an invalidatable ivar, but no definition of an
invalidation method in the @implementation.

The second case might trigger some false positives, for example, when
the method is defined in a category.

llvm-svn: 172104
2013-01-10 20:59:51 +00:00
Anna Zaks 5f37643de1 [analyzer] Fix a false positive in the ivar invalidation checker.
When a property is "inherited" through both a parent class and directly
through a protocol, we should not require the child to invalidate it
since the backing ivar belongs to the parent class.
(Fixes radar://12913734)

llvm-svn: 171769
2013-01-07 19:12:56 +00:00
Anna Zaks 92898a79eb [analyzer] Ivar invalidation: identify properties declared in protocols.
llvm-svn: 166211
2012-10-18 19:17:57 +00:00
Anna Zaks b642fc5db4 [analyzer] Ivar Invalidation: track ivars in continuations and
@implementation.

llvm-svn: 166047
2012-10-16 19:36:37 +00:00
Anna Zaks 0353aad5a9 [analyzer] Re-implement IvarInvalidationChecker so that it verifies that
the validation occurred.

The original implementation was pessimistic - we assumed that ivars
which escape are invalidated. This version is optimistic, it assumes
that the ivars will always be explicitly invalidated: either set to nil
or sent an invalidation message.

llvm-svn: 164868
2012-09-29 00:20:38 +00:00
Anna Zaks a0c8331663 [analyzer] IvarInvalidation: track synthesized ivars and allow escape
through property getters.

llvm-svn: 164802
2012-09-27 21:57:14 +00:00
Anna Zaks 8c0dd36ede [analyzer] Address Jordan's code review comments for r164716.
llvm-svn: 164788
2012-09-27 19:45:08 +00:00
Anna Zaks 9802f9fb2a [analyzer] Add experimental ObjC invalidation method checker.
This checker is annotation driven. It checks that the annotated
invalidation method accesses all ivars of the enclosing objects that are
objects of type, which in turn contains an invalidation method.

This is driven by
__attribute((annotation("objc_instance_variable_invalidator")).

llvm-svn: 164716
2012-09-26 18:55:16 +00:00