Ted Kremenek
eaae1adb94
Add test case for <rdar://problem/8356342>.
...
llvm-svn: 117525
2010-10-28 02:50:32 +00:00
Ted Kremenek
1d08fd9b79
Correctly handle 'Class<...>' when examining Cocoa conventions in the static analyzer. Fixes a crash reported in <rdar://problem/8272168>. Patch by Henry Mason!
...
llvm-svn: 110289
2010-08-05 00:19:24 +00:00
Jordy Rose
4c0a919732
Oops, tabs --> spaces in test.
...
llvm-svn: 107634
2010-07-06 02:42:09 +00:00
Jordy Rose
40c5c24c06
Improve NULL-checking for CFRetain/CFRelease. We now remember that the argument was non-NULL, and we report where the null assumption came from (like AttrNonNullChecker already did).
...
llvm-svn: 107633
2010-07-06 02:34:42 +00:00
Ted Kremenek
a2448b85be
Update retain-release checker to understand changes to how 'super' is represented
...
in the ASTs. Fixes <rdar://problem/8015556>.
llvm-svn: 104389
2010-05-21 21:57:00 +00:00
Ted Kremenek
0f250e4c5b
Fix NoReturnFunctionChecker to properly look at a function's type
...
when determining if it returns. Fixes <rdar://problem/7796563>.
llvm-svn: 99663
2010-03-26 22:57:13 +00:00
Ted Kremenek
1fcc56c57a
Recognize attributes ns_returns_not_retained and cf_returns_not_retained
...
in the static analyzer.
llvm-svn: 96539
2010-02-18 00:06:12 +00:00
Ted Kremenek
2f2692f8ca
Rename -cc1 option '-checker-cfref' to '-analyzer-check-objc-mem'.
...
llvm-svn: 95348
2010-02-05 02:06:54 +00:00
Chris Lattner
f9895c48fd
add a bunch of missing prototypes to tests
...
llvm-svn: 93072
2010-01-09 20:43:19 +00:00
Daniel Dunbar
8fbe78f6fc
Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
...
- This is designed to make it obvious that %clang_cc1 is a "test variable"
which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
can be useful to redefine what gets run as 'clang -cc1' (for example, to set
a default target).
llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Zhongxing Xu
27f686f8ec
Replace clang-cc with clang -cc1.
...
llvm-svn: 91272
2009-12-14 06:34:20 +00:00
Ted Kremenek
f89dcdaf19
Add a PostVisitBlockExpr() method to RetainReleaseChecker to query for
...
the set of variables "captured" by a block. Until the analysis gets
more sophisticated, for now we stop the retain count tracking of any
objects (transitively) referenced by these variables.
llvm-svn: 89929
2009-11-26 02:38:19 +00:00
Ted Kremenek
e6a2780c96
Add really basic support for blocks in the retain/release checker. For now, anytime we pass a tracked object to a block call we stop tracking it.
...
llvm-svn: 89831
2009-11-25 01:35:18 +00:00
Ted Kremenek
a4f7c180ae
Add simple static analyzer checker to check for sending 'release', 'retain', etc. directly to a class. Fixes <rdar://problem/7252064>.
...
llvm-svn: 89449
2009-11-20 05:27:05 +00:00
Daniel Dunbar
8b57697954
Eliminate &&s in tests.
...
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious.
llvm-svn: 86430
2009-11-08 01:45:36 +00:00
Ted Kremenek
43edaa8432
retain/release checker: CGBitmapContextCreateWithData() returns an owned object.
...
llvm-svn: 85867
2009-11-03 05:39:12 +00:00
Ted Kremenek
d1b67db2e8
retain/release checker: Add special handling of CGBitmapContextCreateWithData().
...
Fixes: <rdar://problem/7358899>
llvm-svn: 85864
2009-11-03 05:34:07 +00:00
Ted Kremenek
90c953e98f
retain/release checker: allow 'new', 'copy', 'alloc', 'init' prefix to start before '_' when determining Cocoa fundamental rule.
...
Fixes: <rdar://problem/7265711>
llvm-svn: 84569
2009-10-20 00:13:00 +00:00
Ted Kremenek
55adb821e8
retain/release checker: Use simpler utility method for creating class method summaries. No functionality change.
...
llvm-svn: 84210
2009-10-15 22:25:12 +00:00
Ted Kremenek
b4ec3fc42d
retain/release checker: Recognize that calls to
...
'CVPixelBufferCreateWithPlanarBytes()' and
'CVPixelBufferCreateWithBytes' (Core Video API) can indirectly release
a pixel buffer object via a callback.
This fixes <rdar://problem/7283567>.
llvm-svn: 84064
2009-10-14 00:27:24 +00:00
Ted Kremenek
80816acf9b
retain/release checker: retained objects passed to pthread_create (as
...
the data argument) should not be tracked further until we support full IPA.
(fixes <rdar://problem/7299394>)
llvm-svn: 84047
2009-10-13 22:55:33 +00:00
Ted Kremenek
5c22e110a1
Fix bad grammar in static analyzer diagnostic. Reported by Robert Purves!
...
llvm-svn: 83204
2009-10-01 17:31:50 +00:00
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