Index: lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
+++ lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
@@ -1987,11 +1987,21 @@
}
if (CurrV.getObjKind() == RetEffect::CF) {
- os << " returns a Core Foundation object with a ";
+ if (Sym->getType().isNull()) {
+ os << " returns a Core Foundation object with a ";
+ } else {
+ os << " returns a Core Foundation object of type "
+ << Sym->getType().getAsString() << " with a ";
+ }
}
else {
assert (CurrV.getObjKind() == RetEffect::ObjC);
- os << " returns an Objective-C object with a ";
+ if (Sym->getType().isNull()) {
+ os << " returns an Objective-C object with a ";
+ } else {
+ os << " returns an instance of " << Sym->getType().getAsString()
+ << " with a ";
+ }
}
if (CurrV.isOwned()) {
Index: test/Analysis/edges-new.mm
===================================================================
--- test/Analysis/edges-new.mm
+++ test/Analysis/edges-new.mm
@@ -2438,9 +2438,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFNumberCreate' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFNumberCreate' returns a Core Foundation object of type CFNumberRef with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFNumberCreate' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFNumberCreate' returns a Core Foundation object of type CFNumberRef with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -11355,9 +11355,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of RDar10797980 * with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of RDar10797980 * with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -20325,9 +20325,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
Index: test/Analysis/inlining/path-notes.m
===================================================================
--- test/Analysis/inlining/path-notes.m
+++ test/Analysis/inlining/path-notes.m
@@ -160,7 +160,7 @@
dispatch_once(&token, ^{});
id x = [[[[NSObject alloc] init] autorelease] autorelease];
- // expected-note@-1 {{Method returns an Objective-C object with a +1 retain count}}
+ // expected-note@-1 {{Method returns an instance of NSObject * with a +1 retain count}}
// expected-note@-2 {{Object autoreleased}}
// expected-note@-3 {{Object autoreleased}}
@@ -1840,9 +1840,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
Index: test/Analysis/objc-arc.m
===================================================================
--- test/Analysis/objc-arc.m
+++ test/Analysis/objc-arc.m
@@ -441,9 +441,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFDateCreate' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFDateCreate' returns a Core Foundation object of type CFDateRef with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFDateCreate' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFDateCreate' returns a Core Foundation object of type CFDateRef with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -911,9 +911,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -1091,9 +1091,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFCreateString' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateString' returns a Core Foundation object of type CFStringRef with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFCreateString' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateString' returns a Core Foundation object of type CFStringRef with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -1466,9 +1466,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFDateCreate' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFDateCreate' returns a Core Foundation object of type CFDateRef with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFDateCreate' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFDateCreate' returns a Core Foundation object of type CFDateRef with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -1782,9 +1782,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFCreateString' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateString' returns a Core Foundation object of type CFStringRef with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFCreateString' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateString' returns a Core Foundation object of type CFStringRef with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -1879,9 +1879,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
Index: test/Analysis/plist-output-alternate.m
===================================================================
--- test/Analysis/plist-output-alternate.m
+++ test/Analysis/plist-output-alternate.m
@@ -1191,9 +1191,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFNumberCreate' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFNumberCreate' returns a Core Foundation object of type CFNumberRef with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFNumberCreate' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFNumberCreate' returns a Core Foundation object of type CFNumberRef with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
Index: test/Analysis/plist-output.m
===================================================================
--- test/Analysis/plist-output.m
+++ test/Analysis/plist-output.m
@@ -2239,9 +2239,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of id with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of id with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
Index: test/Analysis/retain-release-arc.m
===================================================================
--- test/Analysis/retain-release-arc.m
+++ test/Analysis/retain-release-arc.m
@@ -53,7 +53,7 @@
CFErrorRef error;
CFDictionaryRef testDict = CFPropertyListCreateWithData(kCFAllocatorDefault, (__bridge CFDataRef)plistData, 0, 0, &error);
#if HAS_ARC
- // expected-note@-2 {{Call to function 'CFPropertyListCreateWithData' returns a Core Foundation object with a +1 retain count}}
+ // expected-note@-2 {{Call to function 'CFPropertyListCreateWithData' returns a Core Foundation object of type CFPropertyListRef with a +1 retain count}}
#endif
return (__bridge NSDictionary *)testDict;
#if HAS_ARC
Index: test/Analysis/retain-release-path-notes-gc.m
===================================================================
--- test/Analysis/retain-release-path-notes-gc.m
+++ test/Analysis/retain-release-path-notes-gc.m
@@ -40,12 +40,12 @@
void creationViaCFCreate () {
- CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected}}
+ CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected}}
return; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'leaked' is not referenced later in this execution path and has a retain count of +1}}
}
void makeCollectable () {
- CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected}}
+ CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected}}
CFRetain(leaked); // expected-note{{Reference count incremented. The object now has a +2 retain count}}
CFMakeCollectable(leaked); // expected-note{{In GC mode a call to 'CFMakeCollectable' decrements an object's retain count and registers the object with the garbage collector. An object must have a 0 retain count to be garbage collected. After this call its retain count is +1}}
NSMakeCollectable(leaked); // expected-note{{In GC mode a call to 'NSMakeCollectable' decrements an object's retain count and registers the object with the garbage collector. Since it now has a 0 retain count the object can be automatically collected by the garbage collector}}
@@ -54,7 +54,7 @@
}
void retainReleaseIgnored () {
- id object = [[NSObject alloc] init]; // expected-note{{Method returns an Objective-C object with a +0 retain count}}
+ id object = [[NSObject alloc] init]; // expected-note{{Method returns an instance of NSObject * with a +0 retain count}}
[object retain]; // expected-note{{In GC mode the 'retain' message has no effect}}
[object release]; // expected-note{{In GC mode the 'release' message has no effect}}
[object autorelease]; // expected-note{{In GC mode an 'autorelease' has no effect}}
@@ -63,12 +63,12 @@
@implementation Foo (FundamentalRuleUnderGC)
- (id)getViolation {
- id object = (id) CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected}}
+ id object = (id) CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected}}
return object; // expected-warning{{leak}} 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 'object' and returned from method 'getViolation' is potentially leaked when using garbage collection. Callers of this method do not expect a returned object with a +1 retain count since they expect the object to be managed by the garbage collector}}
}
- (id)copyViolation {
- id object = (id) CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected}}
+ id object = (id) CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected}}
return object; // expected-warning{{leak}} 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 'object' and returned from method 'copyViolation' is potentially leaked when using garbage collection. Callers of this method do not expect a returned object with a +1 retain count since they expect the object to be managed by the garbage collector}}
}
@end
@@ -137,9 +137,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -283,9 +283,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -729,9 +729,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -1100,9 +1100,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -1287,9 +1287,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count. Core Foundation objects are not automatically garbage collected
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count. Core Foundation objects are not automatically garbage collected
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
Index: test/Analysis/retain-release-path-notes.m
===================================================================
--- test/Analysis/retain-release-path-notes.m
+++ test/Analysis/retain-release-path-notes.m
@@ -44,17 +44,17 @@
void creationViaAlloc () {
- id leaked = [[NSObject alloc] init]; // expected-note{{Method returns an Objective-C object with a +1 retain count}}
+ id leaked = [[NSObject alloc] init]; // expected-note{{Method returns an instance of NSObject * with a +1 retain count}}
return; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'leaked' is not referenced later in this execution path and has a retain count of +1}}
}
void creationViaCFCreate () {
- CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count}}
+ CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count}}
return; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'leaked' is not referenced later in this execution path and has a retain count of +1}}
}
void acquisitionViaMethod (Foo *foo) {
- id leaked = [foo methodWithValue]; // expected-note{{Method returns an Objective-C object with a +0 retain count}}
+ id leaked = [foo methodWithValue]; // expected-note{{Method returns an instance of id with a +0 retain count}}
[leaked retain]; // expected-note{{Reference count incremented. The object now has a +1 retain count}}
[leaked retain]; // expected-note{{Reference count incremented. The object now has a +2 retain count}}
[leaked release]; // expected-note{{Reference count decremented. The object now has a +1 retain count}}
@@ -62,82 +62,82 @@
}
void acquisitionViaProperty (Foo *foo) {
- id leaked = foo.propertyValue; // expected-note{{Property returns an Objective-C object with a +0 retain count}}
+ id leaked = foo.propertyValue; // expected-note{{Property returns an instance of id with a +0 retain count}}
[leaked retain]; // expected-note{{Reference count incremented. The object now has a +1 retain count}}
return; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'leaked' is not referenced later in this execution path and has a retain count of +1}}
}
void acquisitionViaCFFunction () {
- CFTypeRef leaked = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count}}
+ CFTypeRef leaked = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count}}
CFRetain(leaked); // expected-note{{Reference count incremented. The object now has a +1 retain count}}
return; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'leaked' is not referenced later in this execution path and has a retain count of +1}}
}
void explicitDealloc () {
- id object = [[NSObject alloc] init]; // expected-note{{Method returns an Objective-C object with a +1 retain count}}
+ id object = [[NSObject alloc] init]; // expected-note{{Method returns an instance of NSObject * with a +1 retain count}}
[object dealloc]; // expected-note{{Object released by directly sending the '-dealloc' message}}
[object class]; // expected-warning{{Reference-counted object is used after it is released}} // expected-note{{Reference-counted object is used after it is released}}
}
void implicitDealloc () {
- id object = [[NSObject alloc] init]; // expected-note{{Method returns an Objective-C object with a +1 retain count}}
+ id object = [[NSObject alloc] init]; // expected-note{{Method returns an instance of NSObject * with a +1 retain count}}
[object release]; // expected-note{{Object released}}
[object class]; // expected-warning{{Reference-counted object is used after it is released}} // expected-note{{Reference-counted object is used after it is released}}
}
void overAutorelease () {
- id object = [[NSObject alloc] init]; // expected-note{{Method returns an Objective-C object with a +1 retain count}}
+ id object = [[NSObject alloc] init]; // expected-note{{Method returns an instance of NSObject * with a +1 retain count}}
[object autorelease]; // expected-note{{Object autoreleased}}
[object autorelease]; // expected-note{{Object autoreleased}}
return; // expected-warning{{Object autoreleased too many times}} expected-note{{Object was autoreleased 2 times but the object has a +1 retain count}}
}
void autoreleaseUnowned (Foo *foo) {
- id object = foo.propertyValue; // expected-note{{Property returns an Objective-C object with a +0 retain count}}
+ id object = foo.propertyValue; // expected-note{{Property returns an instance of id with a +0 retain count}}
[object autorelease]; // expected-note{{Object autoreleased}}
return; // expected-warning{{Object autoreleased too many times}} expected-note{{Object was autoreleased but has a +0 retain count}}
}
void makeCollectableIgnored () {
- CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count}}
+ CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count}}
CFMakeCollectable(leaked); // expected-note{{When GC is not enabled a call to 'CFMakeCollectable' has no effect on its argument}}
NSMakeCollectable(leaked); // expected-note{{When GC is not enabled a call to 'NSMakeCollectable' has no effect on its argument}}
return; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'leaked' is not referenced later in this execution path and has a retain count of +1}}
}
CFTypeRef CFCopyRuleViolation () {
- CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count}}
+ CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count}}
return object; // 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}}
}
CFTypeRef CFGetRuleViolation () {
- CFTypeRef object = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count}}
+ CFTypeRef object = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count}}
return object; // expected-warning{{leak}} 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 'object' is returned from a function whose name ('CFGetRuleViolation') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation}}
}
@implementation Foo (FundamentalMemoryManagementRules)
- (id)copyViolation {
- id result = self.propertyValue; // expected-note{{Property returns an Objective-C object with a +0 retain count}}
+ id result = self.propertyValue; // expected-note{{Property returns an instance of id with a +0 retain count}}
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}}
}
- (id)copyViolationIndexedSubscript {
- id result = self[0]; // expected-note{{Subscript returns an Objective-C object with a +0 retain count}}
+ id result = self[0]; // expected-note{{Subscript returns an instance of id with a +0 retain count}}
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}}
}
- (id)copyViolationKeyedSubscript {
- id result = self[self]; // expected-note{{Subscript returns an Objective-C object with a +0 retain count}}
+ id result = self[self]; // expected-note{{Subscript returns an instance of id with a +0 retain count}}
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}}
}
- (id)getViolation {
- id result = [[Foo alloc] init]; // expected-note{{Method returns an Objective-C object with a +1 retain count}}
+ id result = [[Foo alloc] init]; // expected-note{{Method returns an instance of Foo * with a +1 retain count}}
return result; // expected-warning{{leak}} 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}}
+ id result = [[Foo alloc] init]; // expected-note{{Method returns an instance of Foo * with a +1 retain count}}
[result autorelease]; // expected-note{{Object autoreleased}}
return result; // expected-warning{{Object with a +0 retain count returned to caller where a +1 (owning) retain count is expected}} expected-note{{Object with a +0 retain count returned to caller where a +1 (owning) retain count is expected}}
}
@@ -212,7 +212,7 @@
}
-(id)initY {
- self = [super init]; //expected-note {{Method returns an Objective-C object with a +1 retain count}}
+ self = [super init]; //expected-note {{Method returns an instance of MyObj * with a +1 retain count}}
return self;
}
@@ -224,7 +224,7 @@
+(void)test {
// initX is inlined since we explicitely mark it as interesting
id x = [[MyObj alloc] initX]; // expected-warning {{Potential leak of an object}}
- // expected-note@-1 {{Method returns an Objective-C object with a +1 retain count}}
+ // expected-note@-1 {{Method returns an instance of MyObj * with a +1 retain count}}
// expected-note@-2 {{Calling 'initX'}}
// expected-note@-3 {{Returning from 'initX'}}
// expected-note@-4 {{Object leaked: allocated object is not referenced later in this execution path and has a retain count of +1}}
@@ -244,20 +244,20 @@
void CFOverAutorelease() {
- CFTypeRef object = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count}}
+ CFTypeRef object = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count}}
CFAutorelease(object); // expected-note{{Object autoreleased}}
CFAutorelease(object); // expected-note{{Object autoreleased}}
return; // expected-warning{{Object autoreleased too many times}} expected-note{{Object was autoreleased 2 times but the object has a +1 retain count}}
}
void CFAutoreleaseUnowned() {
- CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count}}
+ CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count}}
CFAutorelease(object); // expected-note{{Object autoreleased}}
return; // expected-warning{{Object autoreleased too many times}} expected-note{{Object was autoreleased but has a +0 retain count}}
}
void CFAutoreleaseUnownedMixed() {
- CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count}}
+ CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count}}
CFAutorelease(object); // expected-note{{Object autoreleased}}
[(id)object autorelease]; // expected-note{{Object autoreleased}}
return; // expected-warning{{Object autoreleased too many times}} expected-note{{Object was autoreleased 2 times but the object has a +0 retain count}}
@@ -393,9 +393,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -539,9 +539,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -685,9 +685,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Method returns an instance of id with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Method returns an instance of id with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -1056,9 +1056,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Property returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Property returns an instance of id with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Property returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Property returns an instance of id with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -1277,9 +1277,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count
+// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count
+// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -1498,9 +1498,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -1719,9 +1719,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -1940,9 +1940,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of NSObject * with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -2236,9 +2236,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Property returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Property returns an instance of id with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Property returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Property returns an instance of id with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -2457,9 +2457,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -2753,9 +2753,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count
+// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count
+// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -2940,9 +2940,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -3127,9 +3127,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Property returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Property returns an instance of id with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Property returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Property returns an instance of id with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -3314,9 +3314,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Subscript returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Subscript returns an instance of id with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Subscript returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Subscript returns an instance of id with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -3501,9 +3501,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Subscript returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Subscript returns an instance of id with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Subscript returns an Objective-C object with a +0 retain count
+// CHECK-NEXT: Subscript returns an instance of id with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -3688,9 +3688,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of Foo * with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of Foo * with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -3875,9 +3875,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of Foo * with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of Foo * with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -4826,9 +4826,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of MyObj * with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of MyObj * with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -5354,9 +5354,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth1
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of MyObj * with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Method returns an Objective-C object with a +1 retain count
+// CHECK-NEXT: Method returns an instance of MyObj * with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindevent
@@ -5563,9 +5563,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object with a +1 retain count
+// CHECK-NEXT: Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -5859,9 +5859,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count
+// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count
+// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol
@@ -6080,9 +6080,9 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count
+// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count
// CHECK-NEXT: message
-// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object with a +0 retain count
+// CHECK-NEXT: Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count
// CHECK-NEXT:
// CHECK-NEXT:
// CHECK-NEXT: kindcontrol