瀏覽代碼

More tests for // rdar://17259812

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210798 91177308-0d34-0410-b5e6-96231b3b80d8
Fariborz Jahanian 11 年之前
父節點
當前提交
b116a7f12d
共有 2 個文件被更改,包括 21 次插入0 次删除
  1. 17 0
      test/SemaCXX/ns_returns_retained_block_return.cpp
  2. 4 0
      test/SemaObjC/ns_returns_retained_block_return.m

+ 17 - 0
test/SemaCXX/ns_returns_retained_block_return.cpp

@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fblocks -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fblocks -fobjc-arc -fsyntax-only -verify %s
+// expected-no-diagnostics
+// rdar://17259812
+
+typedef void (^BT) ();
+
+class S {
+  BT br() __attribute__((ns_returns_retained)) {
+    return ^{};
+  }
+ BT br1() __attribute__((ns_returns_retained));
+};
+
+BT S::br1() {
+    return ^{};
+}

+ 4 - 0
test/SemaObjC/ns_returns_retained_block_return.m

@@ -11,8 +11,12 @@ BT foo()  __attribute__((ns_returns_retained));
 
 @interface I
 BT foo()  __attribute__((ns_returns_retained));
+- (BT) Meth __attribute__((ns_returns_retained));
++ (BT) ClsMeth __attribute__((ns_returns_retained));
 @end
 
 @implementation I
 BT foo()  __attribute__((ns_returns_retained)) {return ^{}; }
+- (BT) Meth {return ^{}; }
++ (BT) ClsMeth {return ^{}; }
 @end