summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/ARCMT/nsdata.m32
-rw-r--r--clang/test/ARCMT/nsdata.m.result32
2 files changed, 64 insertions, 0 deletions
diff --git a/clang/test/ARCMT/nsdata.m b/clang/test/ARCMT/nsdata.m
new file mode 100644
index 00000000000..c4a555d5bdc
--- /dev/null
+++ b/clang/test/ARCMT/nsdata.m
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
+// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
+// RUN: diff %t %s.result
+
+#include "Common.h"
+
+@interface NSData : NSObject
+- (const void *)bytes;
+@end
+
+typedef struct _NSRange {
+ NSUInteger location;
+ NSUInteger length;
+} NSRange;
+
+@interface NSData (NSExtendedData)
+- (void)getBytes:(void *)buffer length:(NSUInteger)length;
+- (void)getBytes:(void *)buffer range:(NSRange)range;
+@end
+
+@interface NSData (NSDeprecated)
+- (void)getBytes:(void *)buffer;
+@end
+
+void test(NSData* parmdata) {
+ NSData *data, *data2 = parmdata;
+ void *p = [data bytes];
+ p = [data bytes];
+
+ [data2 getBytes:&p length:sizeof(p)];
+ p = [parmdata bytes];
+}
diff --git a/clang/test/ARCMT/nsdata.m.result b/clang/test/ARCMT/nsdata.m.result
new file mode 100644
index 00000000000..0ca2a713b5f
--- /dev/null
+++ b/clang/test/ARCMT/nsdata.m.result
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -x objective-c %s.result
+// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fsyntax-only -x objective-c %s > %t
+// RUN: diff %t %s.result
+
+#include "Common.h"
+
+@interface NSData : NSObject
+- (const void *)bytes;
+@end
+
+typedef struct _NSRange {
+ NSUInteger location;
+ NSUInteger length;
+} NSRange;
+
+@interface NSData (NSExtendedData)
+- (void)getBytes:(void *)buffer length:(NSUInteger)length;
+- (void)getBytes:(void *)buffer range:(NSRange)range;
+@end
+
+@interface NSData (NSDeprecated)
+- (void)getBytes:(void *)buffer;
+@end
+
+void test(NSData* parmdata __attribute__((objc_precise_lifetime))) {
+ NSData *data __attribute__((objc_precise_lifetime)), *data2 __attribute__((objc_precise_lifetime)) = parmdata;
+ void *p = [data bytes];
+ p = [data bytes];
+
+ [data2 getBytes:&p length:sizeof(p)];
+ p = [parmdata bytes];
+}
OpenPOWER on IntegriCloud