summaryrefslogtreecommitdiffstats
path: root/test/PCH/subscripting-literals.m
diff options
context:
space:
mode:
authorAlex Denisov <1101.debian@gmail.com>2015-06-26 05:28:36 +0000
committerAlex Denisov <1101.debian@gmail.com>2015-06-26 05:28:36 +0000
commit3849076ca69f4277bfac55479c2fc0929f5bbd9d (patch)
tree875afa6435e12b75a70d5d2cf7b929859ce94c0e /test/PCH/subscripting-literals.m
parentb839522da5dbe5253c9258c49ece2024960a1358 (diff)
[ObjC] Add NSValue support for objc_boxed_expressions
Patch extends ObjCBoxedExpr to accept records (structs and unions): typedef struct __attribute__((objc_boxable)) _Color { int r, g, b; } Color; Color color; NSValue *boxedColor = @(color); // [NSValue valueWithBytes:&color objCType:@encode(Color)]; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240761 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH/subscripting-literals.m')
-rw-r--r--test/PCH/subscripting-literals.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/PCH/subscripting-literals.m b/test/PCH/subscripting-literals.m
index 1675373441..725e5802a5 100644
--- a/test/PCH/subscripting-literals.m
+++ b/test/PCH/subscripting-literals.m
@@ -30,6 +30,14 @@
@class NSString;
+@interface NSValue
++ (NSValue *)valueWithBytes:(const void *)bytes objCType:(const char *)type;
+@end
+
+typedef struct __attribute__((objc_boxable)) _some_struct {
+ int dummy;
+} some_struct;
+
id testArray(int idx, id p) {
NSMutableArray *array;
array[idx] = p;
@@ -44,4 +52,9 @@ void testDict(NSString *key, id newObject, id oldObject) {
NSDictionary *dict = @{ key: newObject, key: oldObject };
}
+void testBoxableValue() {
+ some_struct ss;
+ id value = @(ss);
+}
+
#endif