]> granicus.if.org Git - clang/commitdiff
Enhance ownership attribute tests with functions that use the attributes!
authorTed Kremenek <kremenek@apple.com>
Tue, 5 May 2009 17:46:22 +0000 (17:46 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 5 May 2009 17:46:22 +0000 (17:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70984 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/retain-release.m

index b7b2efa7976ac28e8e7a2104ce39a40a9c2d8d59..9ed10f812f83b52407b3e28ac1b1642cdb194dce 100644 (file)
@@ -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];