Add back test cases for ns_returns_retained and cf_returns_retained.

llvm-svn: 71312
This commit is contained in:
Ted Kremenek 2009-05-09 03:10:32 +00:00
parent 669604cded
commit d73cfc734b
2 changed files with 34 additions and 0 deletions

View File

@ -124,3 +124,20 @@ void f3() {
CFRetain(A);
}
//===----------------------------------------------------------------------===//
// Tests of ownership attributes.
//===----------------------------------------------------------------------===//
@interface TestOwnershipAttr : NSObject
- (NSString*) returnsAnOwnedString __attribute__((ns_returns_retained));
- (NSString*) returnsAnOwnedCFString __attribute__((cf_returns_retained));
@end
void test_attr_1(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // no-warning
}
void test_attr_1b(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedCFString]; // expected-warning{{leak}}
}

View File

@ -475,3 +475,20 @@ void rdar6704930(unsigned char *s, unsigned int length) {
}
@end
//===----------------------------------------------------------------------===//
// Tests of ownership attributes.
//===----------------------------------------------------------------------===//
@interface TestOwnershipAttr : NSObject
- (NSString*) returnsAnOwnedString __attribute__((ns_returns_retained));
- (NSString*) returnsAnOwnedCFString __attribute__((cf_returns_retained));
@end
void test_attr_1(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}}
}
void test_attr_1b(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedCFString]; // expected-warning{{leak}}
}