1 // XFAIL: target={{.*}}-aix{{.*}}
2 // RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
4 #define EXT_DECL(mod_name) __attribute__((external_source_symbol(language="Swift", defined_in=mod_name)))
5 #define GEN_DECL(mod_name) __attribute__((external_source_symbol(language="Swift", defined_in=mod_name, generated_declaration)))
6 #define PUSH_GEN_DECL(mod_name) push(GEN_DECL(mod_name), apply_to=any(enum, objc_interface, objc_category, objc_protocol))
8 #define GEN_DECL_USR(mod_name, usr) __attribute__((external_source_symbol(language="Swift", defined_in=mod_name, USR=usr, generated_declaration)))
10 // Forward declarations should not affect module namespacing below
14 // This should not be indexed.
15 GEN_DECL("some_module")
17 // CHECK-NOT: [[@LINE-1]]:12 |
19 // CHECK-NOT: [[@LINE-1]]:8 |
22 EXT_DECL("some_module")
24 // CHECK: [[@LINE-1]]:12 | class/Swift | I2 | c:@M@some_module@objc(cs)I2 | {{.*}} | Decl | rel: 0
26 // CHECK: [[@LINE-1]]:8 | instance-method/Swift | method | c:@M@some_module@objc(cs)I2(im)method | -[I2 method] | Decl,Dyn,RelChild | rel: 1
28 // CHECK: [[@LINE-1]]:15 | instance-method/acc-get/Swift | prop | c:@M@some_module@objc(cs)I2(im)prop |
29 // CHECK: [[@LINE-2]]:15 | instance-method/acc-set/Swift | setProp: | c:@M@some_module@objc(cs)I2(im)setProp: |
30 // CHECK: [[@LINE-3]]:15 | instance-property/Swift | prop | c:@M@some_module@objc(cs)I2(py)prop |
34 // CHECK: [[@LINE-1]]:12 | class/Swift | I1 | c:@M@some_module@objc(cs)I1 |
36 // CHECK: [[@LINE-1]]:6 | instance-method/Swift | method | c:@M@some_module@objc(cs)I1(im)method |
39 EXT_DECL("some_module")
41 // CHECK: [[@LINE-1]]:11 | protocol/Swift | ExtProt | c:@M@some_module@objc(pl)ExtProt |
45 // CHECK: [[@LINE-1]]:15 | extension/ObjC | cat | c:@M@some_module@objc(cy)I1@cat |
47 // CHECK: [[@LINE-1]]:8 | instance-method/ObjC | cat_method | c:@M@some_module@objc(cs)I1(im)cat_method
50 EXT_DECL("cat_module")
52 // CHECK: [[@LINE-1]]:15 | extension/Swift | cat2 | c:@CM@cat_module@some_module@objc(cy)I1@cat2 |
54 // CHECK: [[@LINE-1]]:8 | instance-method/Swift | cat_method2 | c:@CM@cat_module@some_module@objc(cs)I1(im)cat_method2
55 @property int cat_prop2;
56 // CHECK: [[@LINE-1]]:15 | instance-method/acc-get/Swift | cat_prop2 | c:@CM@cat_module@some_module@objc(cs)I1(im)cat_prop2 |
57 // CHECK: [[@LINE-2]]:15 | instance-method/acc-set/Swift | setCat_prop2: | c:@CM@cat_module@some_module@objc(cs)I1(im)setCat_prop2: |
58 // CHECK: [[@LINE-3]]:15 | instance-property/Swift | cat_prop2 | c:@CM@cat_module@some_module@objc(cs)I1(py)cat_prop2 |
61 #define NS_ENUM(_name, _type) enum _name:_type _name; enum _name : _type
63 #pragma clang attribute PUSH_GEN_DECL("modname")
66 // CHECK-NOT: [[@LINE-1]]:12 |
68 // CHECK-NOT: [[@LINE-1]]:8 |
72 // CHECK-NOT: [[@LINE-1]]:12 |
73 // CHECK-NOT: [[@LINE-2]]:15 |
75 // CHECK-NOT: [[@LINE-1]]:8 |
79 // CHECK-NOT: [[@LINE-1]]:11 |
81 // CHECK-NOT: [[@LINE-1]]:8 |
84 typedef NS_ENUM(SomeEnum, int) {
85 // CHECK-NOT: [[@LINE-1]]:17 |
87 // CHECK-NOT: [[@LINE-1]]:3 |
90 #pragma clang attribute pop
92 void test2(I3 *i3, id<ExtProt2> prot2, SomeEnum some) {
93 // CHECK: [[@LINE-1]]:12 | class/Swift | I3 | c:@M@modname@objc(cs)I3 |
94 // CHECK: [[@LINE-2]]:23 | protocol/Swift | ExtProt2 | c:@M@modname@objc(pl)ExtProt2 |
95 // CHECK: [[@LINE-3]]:40 | enum/Swift | SomeEnum | c:@M@modname@E@SomeEnum |
97 // CHECK: [[@LINE-1]]:7 | instance-method/Swift | meth | c:@M@modname@objc(cs)I3(im)meth |
99 // CHECK: [[@LINE-1]]:7 | instance-method/Swift | meth2 | c:@CM@modname@objc(cs)I3(im)meth2 |
101 // CHECK: [[@LINE-1]]:10 | instance-method(protocol)/Swift | meth | c:@M@modname@objc(pl)ExtProt2(im)meth |
102 some = SomeEnumFirst;
103 // CHECK: [[@LINE-1]]:10 | enumerator/Swift | SomeEnumFirst | c:@M@modname@E@SomeEnum@SomeEnumFirst |
106 #pragma clang attribute PUSH_GEN_DECL("other_mod_for_cat")
107 @interface I3(cat_other_mod)
108 -(void)meth_other_mod;
110 #pragma clang attribute pop
114 // CHECK: [[@LINE-1]]:7 | instance-method/Swift | meth_other_mod | c:@CM@other_mod_for_cat@modname@objc(cs)I3(im)meth_other_mod |
117 void function() GEN_DECL_USR("SwiftMod", "s:8SwiftMod8functionyyF");
121 // CHECK: [[@LINE-1]]:3 | function/Swift | function | s:8SwiftMod8functionyyF