summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/retain-release.m
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer] Teach RetainCountChecker about VTCompressionSessionEncodeFrame()Devin Coughlin2016-11-111-0/+82
| | | | | | | | | | | | | | | The context argument passed to VideoToolbox's VTCompressionSessionEncodeFrame() function is ultimately passed to a callback supplied when creating the compression session and so may be freed by that callback. To suppress false positives in this case, teach the retain count checker to stop tracking that argument. This isn't suppressed by the usual callback context mechanism because the call to VTCompressionSessionEncodeFrame() doesn't include the callback itself. rdar://problem/27685213 llvm-svn: 286633
* [analyzer] Teach RetainCountChecker about CVFooRetainDevin Coughlin2016-08-111-0/+20
| | | | | | | | | | | | Change the retain count checker to treat CoreFoundation-style "CV"-prefixed reference types from CoreVideo similarly to CoreGraphics types. With this change, we treat CVFooRetain() on a CVFooRef type as a retain. CVFooRelease() APIs are annotated as consuming their parameter, so this change prevents false positives about incorrect decrements of reference counts. <rdar://problem/27116090> llvm-svn: 278382
* Replace __double_underscored type nullability qualifiers with ↵Douglas Gregor2015-06-241-1/+1
| | | | | | | | | | | | | | | | _Uppercase_underscored Addresses a conflict with glibc's __nonnull macro by renaming the type nullability qualifiers as follows: __nonnull -> _Nonnull __nullable -> _Nullable __null_unspecified -> _Null_unspecified This is the major part of rdar://problem/21530726, but does not yet provide the Darwin-specific behavior for the old names. llvm-svn: 240596
* CF_RETURNS_[NOT_]RETAINED on a param makes the inner pointer __nullable.Douglas Gregor2015-06-191-0/+7
| | | | | | | | | | | | | | That is, void cf2(CFTypeRef * __nullable p CF_RETURNS_NOT_RETAINED); is equivalent to void cf2(CFTypeRef __nullable * __nullable p CF_RETURNS_NOT_RETAINED); More rdar://problem/18742441 llvm-svn: 240186
* Allow the cf_returns_[not_]retained attributes to appear on out-parameters.Douglas Gregor2015-06-191-0/+27
| | | | | | | | | | | | | | | | Includes a simple static analyzer check and not much else, but we'll also be able to take advantage of this in Swift. This feature can be tested for using __has_feature(cf_returns_on_parameters). This commit also contains two fixes: - Look through non-typedef sugar when deciding whether something is a CF type. - When (cf|ns)_returns(_not)?_retained is applied to invalid properties, refer to "property" instead of "method" in the error message. rdar://problem/18742441 llvm-svn: 240185
* [analyzer] Check for NULL passed to CFAutorelease.Jordan Rose2014-06-211-15/+31
| | | | | | Patch by Sean McBride, tests adjusted by me. llvm-svn: 211453
* [analyzer] Don't track return value of NSNull +null for retain/release tracking.Ted Kremenek2014-01-031-5452/+5481
| | | | | | Fixes <rdar://problem/12858915>. llvm-svn: 198388
* Implemented delayed processing of 'unavailable' checking, just like with ↵Ted Kremenek2013-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 'deprecated'. Fixes <rdar://problem/15584219> and <rdar://problem/12241361>. This change looks large, but all it does is reuse and consolidate the delayed diagnostic logic for deprecation warnings with unavailability warnings. By doing so, it showed various inconsistencies between the diagnostics, which were close, but not consistent. It also revealed some missing "note:"'s in the deprecated diagnostics that were showing up in the unavailable diagnostics, etc. This change also changes the wording of the core deprecation diagnostics. Instead of saying "function has been explicitly marked deprecated" we now saw "'X' has been been explicitly marked deprecated". It turns out providing a bit more context is useful, and often we got the actual term wrong or it was not very precise (e.g., "function" instead of "destructor"). By just saying the name of the thing that is deprecated/deleted/unavailable we define this issue away. This diagnostic can likely be further wordsmithed to be shorter. llvm-svn: 197627
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-1/+1
| | | | llvm-svn: 196510
* [analyzer] RetainCountChecker: add support for CFAutorelease.Jordan Rose2013-10-071-0/+84
| | | | | | <rdar://problems/13710586&13710643> llvm-svn: 192113
* [analyzer] Stop tracking the objects with attribute cleanup in the ↵Anna Zaks2013-09-171-0/+14
| | | | | | | | RetainCountChecker. This suppresses false positive leaks. We stop tracking a value if it is assigned to a variable declared with a cleanup attribute. llvm-svn: 190835
* [analyzer] RetainCountChecker: don't track through xpc_connection_set_context.Jordan Rose2013-05-021-0/+20
| | | | | | | | | | | | It is unfortunate that we have to mark these exceptions in multiple places. This was already in CallEvent. I suppose it does let us be more precise about saying /which/ arguments have their retain counts invalidated -- the connection's is still valid even though the context object's isn't -- but we're not tracking the retain count of XPC objects anyway. <rdar://problem/13783514> llvm-svn: 180904
* [analyzer] RetainCountChecker: Clean up path notes for autorelease.Jordan Rose2013-04-231-31/+31
| | | | | | | | No functionality change. <rdar://problem/13710586> llvm-svn: 180075
* [analyzer] Cleanup leak warnings: do not print the names of variables from ↵Anna Zaks2013-04-101-1/+20
| | | | | | other functions. llvm-svn: 179219
* [analyzer] RetainCountChecker: refactor annotation handling.Jordan Rose2013-04-041-0/+15
| | | | | | | | | ...and add a new test case. I thought this was broken, but it isn't; refactoring and reformatting anyway so that I don't make the same mistake again. No functionality change. llvm-svn: 178799
* [analyzer]RetainCount: Fix an autorelease related false positive.Anna Zaks2013-01-311-0/+8
| | | | | | | The Cnt variable is adjusted (incremented) for simplification of checking logic. The increment should not be stored in the state. llvm-svn: 174104
* [analyzer] Don't track autorelease pools created by +new.Jordan Rose2013-01-311-2708/+3989
| | | | | | | | | | | | | This matches our behavior for autorelease pools created by +alloc. Some people like to create autorelease pools in one method and release them somewhere else. If you want safe autorelease pool semantics, use the new ARC-compatible syntax: @autoreleasepool { ... } <rdar://problem/13121353> llvm-svn: 174096
* [analyzer] -drain is not an alias for -release.Jordan Rose2013-01-141-0/+15
| | | | | | | | | | | This was previously added to support -[NSAutoreleasePool drain], which behaves like -release under non-GC and "please collect" under GC. We're not currently modeling the autorelease pool stack, though, so we can just take this out entirely. Fixes PR14927. llvm-svn: 172444
* Update RetainCountChecker to understand attribute ns_returns_autoreleased.Ted Kremenek2012-12-201-0/+6
| | | | | | Fixes <rdar://problem/12887356>. llvm-svn: 170724
* [analyzer] Report leaks at the closing brace of a function body.Jordan Rose2012-11-151-2/+2
| | | | | | | | | | | | | | | | | | | | This fixes a few cases where we'd emit path notes like this: +---+ 1| v p = malloc(len); ^ |2 +---+ In general this should make path notes more consistent and more correct, especially in cases where the leak happens on the false branch of an if that jumps directly to the end of the function. There are a couple places where the leak is reported farther away from the cause; these are usually cases where there are several levels of nested braces before the end of the function. This still matches our current behavior for when there /is/ a statement after all the braces, though. llvm-svn: 168070
* [analyzer] Check that the argument to CFMakeCollectable is non-NULL.Jordan Rose2012-11-071-5/+14
| | | | | | Patch by Sean McBride! llvm-svn: 167537
* Fix up more "$t"s in this test that should be "%t"s.Chandler Carruth2012-09-121-1/+1
| | | | llvm-svn: 163673
* Now that I have a test file to work with, disable the Filecheck part of this ↵Ted Kremenek2012-09-101-2/+2
| | | | | | test. llvm-svn: 163536
* Correctly 'cat' out test files.Ted Kremenek2012-09-101-2/+2
| | | | llvm-svn: 163534
* As a debugging aid to unbreak the buildbots, cat the plist files so I can ↵Ted Kremenek2012-09-101-2/+2
| | | | | | view them on different builders. llvm-svn: 163529
* Re-enable FileCheck testing of retain-release.m test, and forceTed Kremenek2012-09-101-3/+3
| | | | | | a C++ dialect. Let's see if this is the portability issue with this test. llvm-svn: 163524
* Temporarily disable FileCheck part of this test.Ted Kremenek2012-09-101-2/+2
| | | | llvm-svn: 163515
* Revert "Revert Ted's r163489 and r163490, due to breakage."Ted Kremenek2012-09-101-2777/+2776
| | | | | | | | | I need to see how this breaks on other platforms when I fix the issue that Benjamin Kramer pointed out. This includes r163489 and r163490, plus a two line change. llvm-svn: 163512
* Revert Ted's r163489 and r163490, due to breakage.NAKAMURA Takumi2012-09-101-2776/+2777
| | | | | | | r163489, "Take another crack at stabilizing the emission order of analyzer" r163490, "Use isBeforeInTranslationUnitThan() instead of operator<." llvm-svn: 163497
* Take another crack at stabilizing the emission order of analyzerTed Kremenek2012-09-101-2777/+2776
| | | | | | | | | | | | | | diagnostics without using FoldingSetNodeIDs. This is done by doing a complete recursive comparison of the PathDiagnostics. Note that the previous method of comparing FoldingSetNodeIDs did not end up relying on unstable things such as pointer addresses, so I suspect this may still have some issues on various buildbots because I'm not sure if the true source of non-determinism has been eliminated. The tests pass for me, so the only way to know is to commit this change and see what happens. llvm-svn: 163489
* Try disabling the FileCheck part of the retain-release.m test to see if it ↵Ted Kremenek2012-09-081-2/+4
| | | | | | fixes the buildbots. llvm-svn: 163462
* Fix bug in BugReporter::RemoveUneededCalls() where "prunable"Ted Kremenek2012-09-081-0/+667
| | | | | | | PathDiagnosticEventPieces were *always* pruned. Instead, they are suppose to only be pruned if the entire call gets pruned. llvm-svn: 163460
* Attempt (again) to stabilize the order of the emission of diagnosticsTed Kremenek2012-09-081-2/+22080
| | | | | | | of the analyzer by using the FullProfile() of a PathDiagnostic for ordering them. llvm-svn: 163455
* Revert "Add plist output for retain-release.m in addition to -verify checking."Ted Kremenek2012-09-081-21887/+2
| | | | llvm-svn: 163447
* Revert "Attempt to make the PathDiagnostic emission order more deterministic by"Ted Kremenek2012-09-081-57/+57
| | | | llvm-svn: 163446
* Attempt to make the PathDiagnostic emission order more deterministic byTed Kremenek2012-09-071-57/+57
| | | | | | looking at PathPieces. llvm-svn: 163427
* Add plist output for retain-release.m in addition to -verify checking.Ted Kremenek2012-09-071-2/+21887
| | | | llvm-svn: 163418
* Revert "Rework the retain-release.m test to use FileCheck and the "text" output"Ted Kremenek2012-09-071-1348/+180
| | | | | | Apparently the output of this test is not deterministic. Needs investigation. llvm-svn: 163377
* Rework the retain-release.m test to use FileCheck and the "text" outputTed Kremenek2012-09-071-180/+1348
| | | | | | | | | | of the analyzer, as the RetainReleaseChecker has many fine-grain path diagnostic events that were not being checked. This uncovered an inconsistency between the path diagnostics between Objective-C and Objective-C++ code in ConditionBRVisitor that was fixed in a recent patch. llvm-svn: 163373
* Teach RetainCountChecker that CFPlugInInstanceCreate does notTed Kremenek2012-09-061-0/+12
| | | | | | | | return a CF object at all. Fixes <rdar://problem/9566345> llvm-svn: 163362
* Refine diagnostics for leaks reported when returning an objectTed Kremenek2012-09-061-0/+9
| | | | | | | | via function/method with [CF,NS]_RETURNS_NOT_RETAINED. Fixes <rdar://problem/11379000>. llvm-svn: 163355
* [analyzer] Make analyzer-ipa=dynamic-bifurcate the default.Anna Zaks2012-08-301-2/+2
| | | | | | | There are two tests regressions that come from the fact that the Retain Count checker does not cancel out inlining of ObjC methods. llvm-svn: 162950
* Teach RetainCountChecker about 'pragma clang arc_cf_code_audited'.Ted Kremenek2012-08-301-0/+13
| | | | llvm-svn: 162934
* [analyzer] More tests for "release and stop tracking".Jordan Rose2012-08-201-1/+17
| | | | | | | | Under GC, a release message is ignored, so "release and stop tracking" just becomes "stop tracking". But CFRelease is still honored. This is the main difference between ns_consumed and cf_consumed. llvm-svn: 162234
* [analyzer] Add a test for "release and stop tracking" behavior.Jordan Rose2012-08-201-0/+14
| | | | | | | | | This is used to handle functions and methods that consume an argument (annotated with the ns_consumed or cf_consumed attribute), but then the argument's retain count may be further modified in a callback. We want to warn about over-releasing, but we can't really track the object afterwards. llvm-svn: 162221
* [analyzer] Add a test case for OS X 10.8's NSMakeCollectable under non-GC.Jordan Rose2012-08-071-0/+13
| | | | | | | This is an additional test for r161349 (ignoring 10.8's annotations for NSMakeCollectable). llvm-svn: 161380
* Add a warning about almost-Doxygen trailing comments: //< and /*< ... */Dmitri Gribenko2012-06-221-1/+1
| | | | llvm-svn: 159001
* static analyzer: add inlining support for directly called blocks.Ted Kremenek2012-06-011-2/+1
| | | | llvm-svn: 157833
* -Wdeprecated warning to include reference (as a note)Fariborz Jahanian2012-05-271-1/+1
| | | | | | to the declaration in this patch. // rdar://10893232 llvm-svn: 157537
* [analyzer] RetainCountChecker: track ObjC boxed expression objects.Jordy Rose2012-05-121-2/+19
| | | | llvm-svn: 156699
OpenPOWER on IntegriCloud