From: Ted Kremenek Date: Tue, 5 May 2009 17:46:22 +0000 (+0000) Subject: Enhance ownership attribute tests with functions that use the attributes! X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4222f21c98e6fdd559f8beb1332663767c64b71e;p=clang Enhance ownership attribute tests with functions that use the attributes! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70984 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index b7b2efa797..9ed10f812f 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -463,6 +463,22 @@ void test_attr_1b(TestOwnershipAttr *X) { NSString *str = [X returnsAnOwnedCFString]; // expected-warning{{leak}} } +__attribute__((ns_returns_owned)) +NSString* test_attr_1c(TestOwnershipAttr *X) { + NSString *str = [X returnsAnOwnedString]; // no-warning + return str; +} + +void test_attr_1d_helper(NSString* str __attribute__((ns_retains))); + +__attribute__((ns_returns_owned)) +NSString* test_attr_1d(TestOwnershipAttr *X) { + NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}} + test_attr_1d_helper(str); + return str; +} + + void test_attr_2(TestOwnershipAttr *X) { NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}} [X myRetain:str];