[arcmt] In GC, transform NSMakeCollectable to CFBridgingRelease.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143698 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/ARCMT/Common.h b/test/ARCMT/Common.h
index 2603730..16856ed 100644
--- a/test/ARCMT/Common.h
+++ b/test/ARCMT/Common.h
@@ -4,8 +4,10 @@
#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE
#endif
+#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
#define CF_CONSUMED __attribute__((cf_consumed))
+#define NS_INLINE static __inline__ __attribute__((always_inline))
#define nil ((void*) 0)
typedef int BOOL;
@@ -19,6 +21,9 @@
typedef const void * CFTypeRef;
CFTypeRef CFRetain(CFTypeRef cf);
+id CFBridgingRelease(CFTypeRef CF_CONSUMED X);
+
+NS_INLINE NS_RETURNS_RETAINED id NSMakeCollectable(CFTypeRef CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
@protocol NSObject
- (BOOL)isEqual:(id)object;
diff --git a/test/ARCMT/GC.m b/test/ARCMT/GC.m
new file mode 100644
index 0000000..90e0b45
--- /dev/null
+++ b/test/ARCMT/GC.m
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result
+// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-gc-only -x objective-c %s > %t
+// RUN: diff %t %s.result
+
+#include "Common.h"
+
+void test1(CFTypeRef *cft) {
+ id x = NSMakeCollectable(cft);
+}
diff --git a/test/ARCMT/GC.m.result b/test/ARCMT/GC.m.result
new file mode 100644
index 0000000..1055aa3
--- /dev/null
+++ b/test/ARCMT/GC.m.result
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result
+// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-gc-only -x objective-c %s > %t
+// RUN: diff %t %s.result
+
+#include "Common.h"
+
+void test1(CFTypeRef *cft) {
+ id x = CFBridgingRelease(cft);
+}