Ted Kremenek
27347135dd
Add static analyzer transfer function support for __builtin_offsetof.
...
llvm-svn: 81820
2009-09-15 00:40:32 +00:00
Ted Kremenek
745c0fa407
Add test case from <rdar://problem/7184450>.
...
llvm-svn: 80700
2009-09-01 18:33:16 +00:00
Ted Kremenek
815fbb6026
retain/release checker: Treat NSObject method '-awakeAfterUsingCoder:'
...
just as if it behaved like an init function. This fixes <rdar://problem/7129086>.
llvm-svn: 79515
2009-08-20 05:13:36 +00:00
Ted Kremenek
d982f001c9
retain/release checker: Special case handling of CFAttributedStringSetAttribute,
...
fixing <rdar://problem/7152619>. Along the way, merge test cases in
'test/Analysis/rdar-6539791.c' into 'test/Analysis/retain-release.m'.
llvm-svn: 79499
2009-08-20 00:57:22 +00:00
Ted Kremenek
4301526e8d
Remove 'StoreManager::OldCastRegion()', TypedViewRegion (which only
...
OldCastRegion used), and the associated command line option
'-analyzer-store=old-basic-cast'.
llvm-svn: 77509
2009-07-29 21:43:22 +00:00
Ted Kremenek
f0951f6d41
Add test case for PR 4596, which is already fixed due to Steve Naroff's overhaul of the Objective-C type system, but isn't in a checker build yet.
...
llvm-svn: 76648
2009-07-21 21:21:04 +00:00
Mike Stump
13876e914b
Prep for new warning.
...
llvm-svn: 76619
2009-07-21 18:58:15 +00:00
Ted Kremenek
e5a068fcb3
Update test case to use '__has_feature' macro.
...
llvm-svn: 76129
2009-07-17 00:19:33 +00:00
Ted Kremenek
c057f417d8
Add basic checking for passing NULL to CFRetain/CFRelease, since those functions
...
are not explicitly marked as not accepting NULL pointers. This check illustrates
how we need more refactoring in the custom-check logic.
llvm-svn: 75570
2009-07-14 00:43:42 +00:00
Ted Kremenek
f66557978e
Switch BasicStoreManager to use the new CastRegion implementation by default,
...
and replace the 'clang-cc' option '-analyzer-store=basic-new-cast' with
'-analyzer-store=basic-old-cast'. We'll keep the old CastRegion implementation
around for a little while for regression testing.
llvm-svn: 75209
2009-07-10 00:41:58 +00:00
Ted Kremenek
eea8c29aa3
Make 'BasicStoreManager' + 'NewCastRegion' testable from the command line using '-analyzer-store=basic-new-cast'.
...
llvm-svn: 74865
2009-07-06 21:58:46 +00:00
Ted Kremenek
0578e43862
Fix <rdar://problem/7033733>. The CF_RETURNS_RETAINED attribute should work if the return type on an Objective-C method is a CF type reference, not just an Objective-C object reference.
...
llvm-svn: 74841
2009-07-06 18:30:43 +00:00
Ted Kremenek
dc935e99e2
Add IOKit test cases for retain/release checker.
...
llvm-svn: 73549
2009-06-16 20:44:39 +00:00
Ted Kremenek
ea1c221334
Enhance attribute cf_returns_retained to also work (in the analyzer)
...
for non-Objctive-C pointer types. This implicitly documents that the
return type is a CF object reference.
llvm-svn: 72968
2009-06-05 23:00:33 +00:00
Ted Kremenek
1036912118
Add special cases to retain checker for 'create' methods in QCView, QCRenderer, and CIContext (Apple APIs).
...
This fixes:
<rdar://problem/6902710> clang: false positives w/QC and CoreImage methods.
llvm-svn: 72187
2009-05-20 22:39:57 +00:00
Ted Kremenek
501ba0365a
Fix PR 4230: Don't flag leaks of NSAutoreleasePools until we know that we aren' at the top-most scope of autorelease pools.
...
llvm-svn: 72065
2009-05-18 23:14:34 +00:00
Ted Kremenek
e4302ee3bb
Fix: <rdar://problem/6893565> False positive: don't flag leaks for return types that cannot be determined to be CF types
...
llvm-svn: 71921
2009-05-16 01:38:01 +00:00
Ted Kremenek
3281977dbb
Fix crash when deriving the enclosing summary of a method whose first selector slot has a null IdentifierInfo*. This happens when analyzing Growl.
...
llvm-svn: 71857
2009-05-15 15:49:00 +00:00
Ted Kremenek
f9fa3cb78a
Fix <rdar://problem/6859457> [NSData dataWithBytesNoCopy] does not return a retained object.
...
llvm-svn: 71797
2009-05-14 21:29:16 +00:00
Ted Kremenek
3b204e4c2e
Add some basic type checking for attributes ns_returns_retained and
...
cf_returns_retained. Currently this attribute can now be applied to any
Objective-C method or C function that returns a pointer or Objective-C object
type.
Modify the tablegen definition of diagnostic 'warn_attribute_wrong_decl_type' to
expect that the diagnostics infrastructure will add quotes around the attribute
name when appropriate. Alonq with this change, I modified the places where this
warning is issued to passed the attribute's IdentifierInfo* instead of having a
hard-coded C constant string.
llvm-svn: 71718
2009-05-13 21:07:32 +00:00
Ted Kremenek
1272f706ca
Fix: <rdar://problem/6320065> false positive - init method returns an object owned by caller
...
Now 'init' methods are treated by the retain/release checker as
claiming their receiver and allocating a new object.
llvm-svn: 71579
2009-05-12 20:06:54 +00:00
Ted Kremenek
95d181936a
Fix <rdar://problem/6877235> Classes typedef-ed to CF objects should get the same treatment as CF objects
...
This was accomplished by having 'isTypeRef' recursively walk the typedef stack.
llvm-svn: 71538
2009-05-12 04:53:03 +00:00
Ted Kremenek
d0e3ab2196
Fix regression reported in <rdar://problem/6866843>. The analyzer should extend the lifetime of an object stored to a container.
...
llvm-svn: 71452
2009-05-11 18:30:24 +00:00
Ted Kremenek
7e7ed527dd
Add test case for <rdar://problem/6257780>.
...
llvm-svn: 71444
2009-05-11 17:45:06 +00:00
Ted Kremenek
dee56e37fc
retain/release checker: Flag a warning for non-owned objects returned
...
where an owned one is expected. Also add preliminary checking for
returning a positive retain count object in GC mode where an owned GC
object is expected.
llvm-svn: 71388
2009-05-10 06:25:57 +00:00
Ted Kremenek
3978f7972d
analyzer:
...
- Improve -autorelease diagnostics.
- Improve VLA diagnostics.
- Use "short description" for bug when outputting to TextDiagnostics
llvm-svn: 71383
2009-05-10 05:11:21 +00:00
Ted Kremenek
d73cfc734b
Add back test cases for ns_returns_retained and cf_returns_retained.
...
llvm-svn: 71312
2009-05-09 03:10:32 +00:00
Ted Kremenek
2d0ff62a0d
It lives! The retain/release checker now tracks objects that are sent
...
'autorelease'.
llvm-svn: 71307
2009-05-09 01:50:57 +00:00
Ted Kremenek
062c14ba24
Remove experimental ownership attributes from Clang.
...
llvm-svn: 71216
2009-05-08 15:19:25 +00:00
Ted Kremenek
ba53fe98e7
More attribute renaming:
...
- Rename 'ns_returns_owned' -> 'ns_returns_retained'.
- Rename 'cf_returns_owned' -> 'cf_returns_retained'.
llvm-svn: 71182
2009-05-07 21:49:45 +00:00
Ted Kremenek
213ff5a98e
Implement attribute 'ns_autorelease'.
...
llvm-svn: 70990
2009-05-05 18:44:20 +00:00
Ted Kremenek
dad8889d62
Enhance ownership attribute tests with functions that use the attributes!
...
llvm-svn: 70984
2009-05-05 17:46:22 +00:00
Ted Kremenek
94c464ef22
Implement attribute 'cf_returns_owned' (mirrors 'ns_returns_owned').
...
llvm-svn: 70952
2009-05-05 00:46:09 +00:00
Ted Kremenek
de1aa1e4dd
Rename ownership attributes:
...
ns_ownership_returns -> ns_returns_owned
ns_ownership_retain -> ns_retains
ns_ownership_release -> ns_releases
cf_ownership_retain -> cf_retains
cf_ownership_release -> cf_releases
llvm-svn: 70949
2009-05-05 00:21:59 +00:00
Ted Kremenek
bbec22d2b2
Rename attribute 'ns_ownership_returns' to 'ns_returns_ownership'.
...
llvm-svn: 70941
2009-05-04 23:52:59 +00:00
Ted Kremenek
0836a19931
Rename attributes 'objc_ownership...' to 'ns_ownership...'.
...
llvm-svn: 70897
2009-05-04 19:10:19 +00:00
Ted Kremenek
5dbfa3fadd
Rename attributes:
...
'objc_ownership_cfretain' -> 'cf_ownership_retain'
'objc_ownership_cfrelease' -> 'cf_ownership_release'
Motivation: Core Foundation objects can be used in isolation from Objective-C,
and this forces users to reason about the separate semantics of CF objects. More
Sema support pending.
llvm-svn: 70884
2009-05-04 17:29:57 +00:00
Ted Kremenek
bc76c72f94
Remove support for ObjCMethodDecl attributes that appear between the
...
return type and the selector. This is inconsistent with C functions
(where such attributes would be placed on the return type, not the the
FunctionDecl), and is inconsistent with what people are use to seeing.
llvm-svn: 70878
2009-05-04 17:04:30 +00:00
Ted Kremenek
2ff8a79d27
retain/release checker: Hook up attributes 'objc_ownership_retain' and
...
'objc_ownership_release' to the effects on receivers.
llvm-svn: 70507
2009-04-30 20:00:31 +00:00
Ted Kremenek
2acb5adac9
Allow attributes 'objc_ownership_retain' and 'objc_ownership_release' to be
...
applied to ObjCMethodDecls, not just parameters. This allows one to specific
side-effects on the receiver of a message expression. No checker support yet.
llvm-svn: 70505
2009-04-30 19:18:03 +00:00
Ted Kremenek
290fbb1d42
Hook up Sema support for attributes on Objective-C method declarations that
...
appear between the return type and the selector. This is a separate code path
from regular attribute processing, as we only want to (a) accept only a specific
set of attributes in this place and (b) want to distinguish to clients the
context in which an attribute was added to an ObjCMethodDecl.
Currently, the attribute 'objc_ownership_returns' is the only attribute that
uses this new feature. Shortly I will add a warning for 'objc_ownership_returns'
to be placed at the end of a method declaration.
llvm-svn: 70504
2009-04-30 18:41:06 +00:00
Ted Kremenek
8c06515f2b
Add parsing support in an Objective-C method declaration for attributes between
...
the return type and selector. Haven't hooked this up to Sema yet.
llvm-svn: 70501
2009-04-30 17:55:29 +00:00
Ted Kremenek
223a7d5445
retain/release checker: When determining whether an analyzed method can return
...
an owned object, consult its summary instead of inspecting the selector. This
picks up annotations, and is just more general.
llvm-svn: 70429
2009-04-29 23:03:22 +00:00
Ted Kremenek
6bd78709f2
retain/release checker: Hoist code for bug reports above transfer function logic
...
(those diffs are just code moving) and move the logic for "return of owned
object" leak reporting to EvalReturnStmt.
llvm-svn: 70399
2009-04-29 18:50:19 +00:00
Ted Kremenek
ebc6d91f4e
Add regression test case provided by <rdar://problem/6833332>.
...
llvm-svn: 70350
2009-04-29 00:41:31 +00:00
Ted Kremenek
89c3861061
Improve retain/release test cases for ownership attributes.
...
llvm-svn: 70327
2009-04-28 21:43:40 +00:00
Ted Kremenek
84bfa2c2dc
Add two new checker-specific attributes: 'objc_ownership_release' and
...
'objc_ownership_cfrelease'. These are the 'release' equivalents of
'objc_ownership_retain' and 'objc_ownership_cfretain' respectively.
llvm-svn: 70235
2009-04-27 19:36:56 +00:00
Ted Kremenek
ebbef7d0d3
Add new checker-specific attribute 'objc_ownership_cfretain'. This is the same
...
as 'objc_ownership_cfretain' except that the method acts like a CFRetain instead
of a [... retain] (important in GC modes). Checker support is wired up, but
currently only for Objective-C message expressions (not function calls).
llvm-svn: 70218
2009-04-27 18:27:22 +00:00
Ted Kremenek
e75de95408
Hook up attribute 'objc_ownership_retain' to the analyzer. This attribute allows
...
users to specify that a method's argument is visibly retained (reference count
incremented).
llvm-svn: 70008
2009-04-25 01:21:50 +00:00
Ted Kremenek
2cfd264636
Add new checker-specific attribute 'objc_ownership_retain'. This isn't hooked up
...
to the checker yet, but essentially it allows a user to specify that an
Objective-C method or C function increments the reference count of a passed
object.
llvm-svn: 70005
2009-04-25 00:17:17 +00:00