summaryrefslogtreecommitdiffstats
path: root/test/Analysis
diff options
context:
space:
mode:
authorJordy Rose <jediknil@belkadan.com>2012-03-17 05:49:15 +0000
committerJordy Rose <jediknil@belkadan.com>2012-03-17 05:49:15 +0000
commit74b7b2b42dd710ccea78d86a47c979d4b2af7093 (patch)
tree2975b30fcf81e89178626a0c64de066816b3c55d /test/Analysis
parent7a4a9cddea09ced9aab7228ad81892854f97b6fa (diff)
[analyzer] Don't claim an object was returned with +1 retain count before counting autoreleases. Fixes PR10376.
(Also, 80-column violations.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152976 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/retain-release-path-notes.m6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Analysis/retain-release-path-notes.m b/test/Analysis/retain-release-path-notes.m
index adf40ec788..c3f5fcda44 100644
--- a/test/Analysis/retain-release-path-notes.m
+++ b/test/Analysis/retain-release-path-notes.m
@@ -123,4 +123,10 @@ CFTypeRef CFGetRuleViolation () {
id result = [[Foo alloc] init]; // expected-warning{{leak}} expected-note{{Method returns an Objective-C object with a +1 retain count}}
return result; // expected-note{{Object returned to caller as an owning reference (single retain count transferred to caller)}} expected-note{{Object leaked: object allocated and stored into 'result' is returned from a method whose name ('getViolation') does not start with 'copy', 'mutableCopy', 'alloc' or 'new'. This violates the naming convention rules given in the Memory Management Guide for Cocoa}}
}
+
+- (id)copyAutorelease {
+ id result = [[Foo alloc] init]; // expected-note{{Method returns an Objective-C object with a +1 retain count}}
+ [result autorelease]; // expected-note{{Object sent -autorelease message}}
+ return result; // expected-warning{{Object with a +0 retain count returned to caller where a +1 (owning) retain count is expected}} expected-note{{Object returned to caller with a +0 retain count}} expected-note{{Object with a +0 retain count returned to caller where a +1 (owning) retain count is expected}}
+}
@end