@@ -41,8 +41,8 @@ final class IndexTests: XCTestCase {
41
41
42
42
try ws. buildAndIndex ( )
43
43
44
- let csym = Symbol ( usr: usr, name: " c() " , kind: . function)
45
- let asym = Symbol ( usr: " s:4main1ayyF " , name: " a() " , kind: . function)
44
+ let csym = Symbol ( usr: usr, name: " c() " , kind: . function, language : . swift )
45
+ let asym = Symbol ( usr: " s:4main1ayyF " , name: " a() " , kind: . function, language : . swift )
46
46
47
47
let ccanon = SymbolOccurrence (
48
48
symbol: csym,
@@ -92,7 +92,7 @@ final class IndexTests: XCTestCase {
92
92
[
93
93
ccall,
94
94
SymbolOccurrence (
95
- symbol: Symbol ( usr: " s:4main1byyF " , name: " b() " , kind: . function) ,
95
+ symbol: Symbol ( usr: " s:4main1byyF " , name: " b() " , kind: . function, language : . swift ) ,
96
96
location: SymbolLocation ( ws. testLoc ( " b:call " ) ) ,
97
97
roles: [ . reference, . call, . calledBy, . containedBy] ,
98
98
relations: [
@@ -108,7 +108,7 @@ final class IndexTests: XCTestCase {
108
108
109
109
#if os(macOS)
110
110
111
- let cdecl = Symbol ( usr: " c:objc(cs)C " , name: " C " , kind: . class)
111
+ let cdecl = Symbol ( usr: " c:objc(cs)C " , name: " C " , kind: . class, language : . objc )
112
112
let cdeclOccs = index. occurrences ( ofUSR: cdecl. usr, roles: . all)
113
113
checkOccurrences ( cdeclOccs, expected: [
114
114
cdecl. at ( ws. testLoc ( " C:decl " ) , roles: [ . declaration, . canonical] ) ,
@@ -117,7 +117,7 @@ final class IndexTests: XCTestCase {
117
117
cdecl. at ( ws. testLoc ( " C:ref:e.mm " ) , roles: . reference) ,
118
118
] )
119
119
120
- let cmethod = Symbol ( usr: " c:objc(cs)C(im)method " , name: " method " , kind: . instanceMethod)
120
+ let cmethod = Symbol ( usr: " c:objc(cs)C(im)method " , name: " method " , kind: . instanceMethod, language : . objc )
121
121
let cmethodOccs = index. occurrences ( ofUSR: cmethod. usr, roles: . all)
122
122
checkOccurrences ( cmethodOccs, expected: [
123
123
cmethod. with ( name: " method() " ) . at ( ws. testLoc ( " C.method:call:swift " ) , roles: [ . call, . dynamic] ) ,
@@ -127,15 +127,15 @@ final class IndexTests: XCTestCase {
127
127
] )
128
128
#endif
129
129
130
- let ddecl = Symbol ( usr: " c:@S@D " , name: " D " , kind: . class)
130
+ let ddecl = Symbol ( usr: " c:@S@D " , name: " D " , kind: . class, language : . c )
131
131
let dOccs = index. occurrences ( ofUSR: ddecl. usr, roles: . all)
132
132
checkOccurrences ( dOccs, expected: [
133
133
ddecl. at ( ws. testLoc ( " D:def " ) , roles: . definition) ,
134
134
ddecl. at ( ws. testLoc ( " D:ref " ) , roles: . reference) ,
135
135
ddecl. at ( ws. testLoc ( " D:ref:e.mm " ) , roles: . reference) ,
136
136
] )
137
137
138
- let bhdecl = Symbol ( usr: " c:@F@bridgingHeader " , name: " bridgingHeader " , kind: . function)
138
+ let bhdecl = Symbol ( usr: " c:@F@bridgingHeader " , name: " bridgingHeader " , kind: . function, language : . c )
139
139
let bridgingHeaderOccs = index. occurrences ( ofUSR: bhdecl. usr, roles: . all)
140
140
checkOccurrences ( bridgingHeaderOccs, expected: [
141
141
bhdecl. at ( ws. testLoc ( " bridgingHeader:decl " ) , roles: . declaration) ,
@@ -154,15 +154,15 @@ final class IndexTests: XCTestCase {
154
154
let index = ws. index
155
155
156
156
#if os(macOS)
157
- let cdecl = Symbol ( usr: " c:objc(cs)C " , name: " C " , kind: . class)
157
+ let cdecl = Symbol ( usr: " c:objc(cs)C " , name: " C " , kind: . class, language : . c )
158
158
let cdeclOccs = index. occurrences ( ofUSR: cdecl. usr, roles: . all)
159
159
checkOccurrences ( cdeclOccs, expected: [
160
160
cdecl. at ( ws. testLoc ( " C:decl " ) , roles: [ . declaration, . canonical] ) ,
161
161
cdecl. at ( ws. testLoc ( " C:def " ) , roles: . definition) ,
162
162
cdecl. at ( ws. testLoc ( " C:ref:swift " ) , roles: . reference) ,
163
163
] )
164
164
165
- let cmethod = Symbol ( usr: " c:objc(cs)C(im)method " , name: " method " , kind: . instanceMethod)
165
+ let cmethod = Symbol ( usr: " c:objc(cs)C(im)method " , name: " method " , kind: . instanceMethod, language : . c )
166
166
let cmethodOccs = index. occurrences ( ofUSR: cmethod. usr, roles: . all)
167
167
checkOccurrences ( cmethodOccs, expected: [
168
168
cmethod. with ( name: " method() " ) . at ( ws. testLoc ( " C.method:call:swift " ) , roles: [ . call, . dynamic] ) ,
@@ -171,7 +171,7 @@ final class IndexTests: XCTestCase {
171
171
] )
172
172
#endif
173
173
174
- let bhdecl = Symbol ( usr: " c:@F@bridgingHeader " , name: " bridgingHeader " , kind: . function)
174
+ let bhdecl = Symbol ( usr: " c:@F@bridgingHeader " , name: " bridgingHeader " , kind: . function, language : . c )
175
175
let bridgingHeaderOccs = index. occurrences ( ofUSR: bhdecl. usr, roles: . all)
176
176
checkOccurrences ( bridgingHeaderOccs, expected: [
177
177
bhdecl. at ( ws. testLoc ( " bridgingHeader:decl " ) , roles: . declaration) ,
@@ -191,7 +191,7 @@ final class IndexTests: XCTestCase {
191
191
let index = ws. index
192
192
193
193
#if os(macOS)
194
- let cdecl = Symbol ( usr: " c:objc(cs)C " , name: " C " , kind: . class)
194
+ let cdecl = Symbol ( usr: " c:objc(cs)C " , name: " C " , kind: . class, language : . c )
195
195
let getOccs = { index. occurrences ( ofUSR: cdecl. usr, roles: . all) }
196
196
197
197
// Output units are not set yet.
@@ -205,7 +205,7 @@ final class IndexTests: XCTestCase {
205
205
index. addUnitOutFilePaths ( indexOutputPaths, waitForProcessing: true )
206
206
207
207
// The bridging header is referenced as a PCH unit dependency, make sure we can see the data.
208
- let bhdecl = Symbol ( usr: " c:@F@bridgingHeader " , name: " bridgingHeader " , kind: . function)
208
+ let bhdecl = Symbol ( usr: " c:@F@bridgingHeader " , name: " bridgingHeader " , kind: . function, language : . c )
209
209
let bridgingHeaderOccs = index. occurrences ( ofUSR: bhdecl. usr, roles: . all)
210
210
checkOccurrences ( bridgingHeaderOccs, expected: [
211
211
bhdecl. at ( ws. testLoc ( " bridgingHeader:decl " ) , roles: . declaration) ,
@@ -239,7 +239,7 @@ final class IndexTests: XCTestCase {
239
239
let index = ws. index
240
240
241
241
#if os(macOS)
242
- let cdecl = Symbol ( usr: " c:objc(cs)C " , name: " C " , kind: . class)
242
+ let cdecl = Symbol ( usr: " c:objc(cs)C " , name: " C " , kind: . class, language : . c )
243
243
let getOccs = { index. occurrences ( ofUSR: cdecl. usr, roles: . all) }
244
244
245
245
// Output units are not set yet.
@@ -253,7 +253,7 @@ final class IndexTests: XCTestCase {
253
253
index. addUnitOutFilePaths ( indexOutputPaths, waitForProcessing: true )
254
254
255
255
// The bridging header is referenced as a PCH unit dependency, make sure we can see the data.
256
- let bhdecl = Symbol ( usr: " c:@F@bridgingHeader " , name: " bridgingHeader " , kind: . function)
256
+ let bhdecl = Symbol ( usr: " c:@F@bridgingHeader " , name: " bridgingHeader " , kind: . function, language : . c )
257
257
let bridgingHeaderOccs = index. occurrences ( ofUSR: bhdecl. usr, roles: . all)
258
258
checkOccurrences ( bridgingHeaderOccs, expected: [
259
259
bhdecl. at ( ws. testLoc ( " bridgingHeader:decl " ) , roles: . declaration) ,
@@ -279,7 +279,7 @@ final class IndexTests: XCTestCase {
279
279
guard let ws = try staticTibsTestWorkspace ( name: " SwiftModules " ) else { return }
280
280
try ws. buildAndIndex ( )
281
281
282
- let aaa = Symbol ( usr: " s:1A3aaayyF " , name: " aaa() " , kind: . function)
282
+ let aaa = Symbol ( usr: " s:1A3aaayyF " , name: " aaa() " , kind: . function, language : . swift )
283
283
checkOccurrences ( ws. index. occurrences ( ofUSR: aaa. usr, roles: . all) , expected: [
284
284
aaa. at ( ws. testLoc ( " aaa:def " ) , moduleName: " A " , roles: . definition) ,
285
285
aaa. at ( ws. testLoc ( " aaa:call " ) , moduleName: " B " , roles: . call) ,
@@ -291,7 +291,7 @@ final class IndexTests: XCTestCase {
291
291
guard let ws = try mutableTibsTestWorkspace ( name: " proj1 " ) else { return }
292
292
try ws. buildAndIndex ( )
293
293
294
- let cdecl = Symbol ( usr: " s:4main1cyyF " , name: " c() " , kind: . function)
294
+ let cdecl = Symbol ( usr: " s:4main1cyyF " , name: " c() " , kind: . function, language : . swift )
295
295
let roles : SymbolRole = [ . reference, . definition, . declaration]
296
296
297
297
checkOccurrences ( ws. index. occurrences ( ofUSR: cdecl. usr, roles: . all) , expected: [
@@ -348,7 +348,7 @@ final class IndexTests: XCTestCase {
348
348
waitUntilDoneInitializing: true ,
349
349
listenToUnitEvents: true )
350
350
351
- let csym = Symbol ( usr: " s:4main1cyyF " , name: " c() " , kind: . function)
351
+ let csym = Symbol ( usr: " s:4main1cyyF " , name: " c() " , kind: . function, language : . swift )
352
352
let waitOccs = indexWait. occurrences ( ofUSR: csym. usr, roles: [ . reference, . definition] )
353
353
354
354
checkOccurrences ( waitOccs, expected: [
@@ -547,7 +547,7 @@ final class IndexTests: XCTestCase {
547
547
try ws. buildAndIndex ( )
548
548
let index = ws. index
549
549
550
- let ddecl = Symbol ( usr: " c:@S@D " , name: " D " , kind: . class)
550
+ let ddecl = Symbol ( usr: " c:@S@D " , name: " D " , kind: . class, language : . c )
551
551
let getOccs = { index. occurrences ( ofUSR: ddecl. usr, roles: . all) }
552
552
553
553
// Output units are not set yet.
@@ -569,7 +569,7 @@ final class IndexTests: XCTestCase {
569
569
] )
570
570
571
571
// The bridging header is referenced as a PCH unit dependency, make sure we can see the data.
572
- let bhdecl = Symbol ( usr: " c:@F@bridgingHeader " , name: " bridgingHeader " , kind: . function)
572
+ let bhdecl = Symbol ( usr: " c:@F@bridgingHeader " , name: " bridgingHeader " , kind: . function, language : . c )
573
573
let bridgingHeaderOccs = index. occurrences ( ofUSR: bhdecl. usr, roles: . all)
574
574
checkOccurrences ( bridgingHeaderOccs, expected: [
575
575
bhdecl. at ( ws. testLoc ( " bridgingHeader:decl " ) , roles: . declaration) ,
@@ -634,25 +634,25 @@ final class IndexTests: XCTestCase {
634
634
635
635
try ws. buildAndIndex ( )
636
636
637
- let asyncFuncSym = Symbol ( usr: " s:4main9asyncFuncyyYaF " , name: " asyncFunc() " , kind: . function, properties: . swiftAsync)
637
+ let asyncFuncSym = Symbol ( usr: " s:4main9asyncFuncyyYaF " , name: " asyncFunc() " , kind: . function, properties: . swiftAsync, language : . swift )
638
638
let asyncFuncOccs = index. occurrences ( ofUSR: asyncFuncSym. usr, roles: . definition)
639
639
checkOccurrences ( asyncFuncOccs, expected: [
640
640
asyncFuncSym. at ( ws. testLoc ( " asyncFunc:def " ) , roles: . definition)
641
641
] )
642
642
643
- let asyncMethSym = Symbol ( usr: " s:4main8MyStructV11asyncMethodyyYaF " , name: " asyncMethod() " , kind: . instanceMethod, properties: . swiftAsync)
643
+ let asyncMethSym = Symbol ( usr: " s:4main8MyStructV11asyncMethodyyYaF " , name: " asyncMethod() " , kind: . instanceMethod, properties: . swiftAsync, language : . swift )
644
644
let asyncMethOccs = index. occurrences ( ofUSR: asyncMethSym. usr, roles: . definition)
645
645
checkOccurrences ( asyncMethOccs, expected: [
646
646
asyncMethSym. at ( ws. testLoc ( " asyncMethod:def " ) , roles: . definition)
647
647
] )
648
648
649
- let testMeSym = Symbol ( usr: " s:4main10MyTestCaseC6testMeyyF " , name: " testMe() " , kind: . instanceMethod, properties: . unitTest)
649
+ let testMeSym = Symbol ( usr: " s:4main10MyTestCaseC6testMeyyF " , name: " testMe() " , kind: . instanceMethod, properties: . unitTest, language : . swift )
650
650
let testMeOccs = index. occurrences ( ofUSR: testMeSym. usr, roles: . definition)
651
651
checkOccurrences ( testMeOccs, expected: [
652
652
testMeSym. at ( ws. testLoc ( " testMe:def " ) , roles: . definition)
653
653
] )
654
654
655
- let testMeAsyncSym = Symbol ( usr: " s:4main10MyTestCaseC11testMeAsyncyyYaF " , name: " testMeAsync() " , kind: . instanceMethod, properties: [ . unitTest, . swiftAsync] )
655
+ let testMeAsyncSym = Symbol ( usr: " s:4main10MyTestCaseC11testMeAsyncyyYaF " , name: " testMeAsync() " , kind: . instanceMethod, properties: [ . unitTest, . swiftAsync] , language : . swift )
656
656
let testMeAsyncOccs = index. occurrences ( ofUSR: testMeAsyncSym. usr, roles: . definition)
657
657
checkOccurrences ( testMeAsyncOccs, expected: [
658
658
testMeAsyncSym. at ( ws. testLoc ( " testMeAsync:def " ) , roles: . definition)
@@ -665,7 +665,7 @@ final class IndexTests: XCTestCase {
665
665
666
666
try ws. buildAndIndex ( )
667
667
668
- let largeType = Symbol ( usr: " c:@CT@LargeType " , name: " LargeType " , kind: . concept)
668
+ let largeType = Symbol ( usr: " c:@CT@LargeType " , name: " LargeType " , kind: . concept, language : . cxx )
669
669
let largeTypeOccs = ws. index. occurrences ( ofUSR: largeType. usr, roles: . all)
670
670
checkOccurrences ( largeTypeOccs, expected: [
671
671
largeType. at ( ws. testLoc ( " LargeType:def " ) , roles: . definition) ,
0 commit comments