]> granicus.if.org Git - clang/commitdiff
[attributes] Add more tests for os_returns_retained
authorGeorge Karpenkov <ekarpenkov@apple.com>
Thu, 6 Dec 2018 01:21:38 +0000 (01:21 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Thu, 6 Dec 2018 01:21:38 +0000 (01:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348443 91177308-0d34-0410-b5e6-96231b3b80d8

test/Sema/attr-osobject.mm

index dbd9122a8fa8de98f712b52bcf0aa3db51cf91fa..adabb6df0fcca5cf09ea9af5a5515b69b70644b0 100644 (file)
@@ -1,6 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-// expected-no-diagnostics
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
 
 struct S {};
 
@@ -9,3 +7,9 @@ struct S {};
   - (S*) generateS __attribute__((os_returns_retained));
   - (void) takeS:(S*) __attribute__((os_consumed)) s;
 @end
+
+typedef __attribute__((os_returns_retained)) id (^blockType)(); // expected-warning{{'os_returns_retained' attribute only applies to functions, Objective-C methods, and Objective-C properties}}
+
+__auto_type b = ^ id (id filter)  __attribute__((os_returns_retained))  { // expected-warning{{'os_returns_retained' attribute only applies to functions, Objective-C methods, and Objective-C properties}}
+  return filter;
+};