blob: 83fb4d3cc497eb46191fe5b614ec60ef7dffd237 [file] [log] [blame]
Fariborz Jahanian5cbbb1be2014-06-11 16:52:44 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2// expected-no-diagnostics
3// rdar://17238954
4
5typedef const struct __attribute__((objc_bridge(NSAttributedString))) __CFAttributedString *CFAttributedStringRef;
6
7typedef struct __attribute__((objc_bridge_mutable(NSMutableAttributedString))) __CFAttributedString *CFMutableAttributedStringRef;
8
9@interface NSAttributedString
10@end
11
12@interface NSMutableAttributedString
13@end
14
15struct __CFAttributedString {
16};
17
Fariborz Jahanian9af6a782014-06-11 19:10:46 +000018void Test1(CFAttributedStringRef attrStr, CFMutableAttributedStringRef mutable_attrStr)
Fariborz Jahanian5cbbb1be2014-06-11 16:52:44 +000019{
Fariborz Jahanian9af6a782014-06-11 19:10:46 +000020 id x = (NSAttributedString *) attrStr;
21 id x1 =(NSAttributedString *) mutable_attrStr;
22 id x2 = (NSMutableAttributedString *) attrStr;
23 id x3 = (NSMutableAttributedString *) mutable_attrStr;
Fariborz Jahanian5cbbb1be2014-06-11 16:52:44 +000024}
25
Fariborz Jahanian9af6a782014-06-11 19:10:46 +000026void Test2(NSAttributedString *ns_attrStr, NSMutableAttributedString *ns_mutable_attr_Str) {
27 CFAttributedStringRef cfsr = (CFAttributedStringRef) ns_attrStr;
28 CFMutableAttributedStringRef cfsr1 = (CFMutableAttributedStringRef) ns_attrStr;
29 CFAttributedStringRef cfsr2 = (CFAttributedStringRef) ns_mutable_attr_Str;
30 CFMutableAttributedStringRef cfsr3 = (CFMutableAttributedStringRef) ns_mutable_attr_Str;
Fariborz Jahanian5cbbb1be2014-06-11 16:52:44 +000031}
32
Fariborz Jahanian9af6a782014-06-11 19:10:46 +000033// Tests with no definition declaration for struct __NDCFAttributedString.
34typedef const struct __attribute__((objc_bridge(NSAttributedString))) __NDCFAttributedString *NDCFAttributedStringRef;
35
36typedef struct __attribute__((objc_bridge_mutable(NSMutableAttributedString))) __NDCFAttributedString *NDCFMutableAttributedStringRef;
37
38void Test3(NDCFAttributedStringRef attrStr, NDCFMutableAttributedStringRef mutable_attrStr)
39{
40 id x = (NSAttributedString *) attrStr;
41 id x1 =(NSAttributedString *) mutable_attrStr;
42 id x2 = (NSMutableAttributedString *) attrStr;
43 id x3 = (NSMutableAttributedString *) mutable_attrStr;
44}
45
46void Test4(NSAttributedString *ns_attrStr, NSMutableAttributedString *ns_mutable_attr_Str) {
47 NDCFAttributedStringRef cfsr = (NDCFAttributedStringRef) ns_attrStr;
48 NDCFMutableAttributedStringRef cfsr1 = (NDCFMutableAttributedStringRef) ns_attrStr;
49 NDCFAttributedStringRef cfsr2 = (NDCFAttributedStringRef) ns_mutable_attr_Str;
50 NDCFMutableAttributedStringRef cfsr3 = (NDCFMutableAttributedStringRef) ns_mutable_attr_Str;
51}