File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,18 @@ package final class CheckedIndex {
268
268
containerSymbol = extendedSymbol
269
269
}
270
270
let result : [ String ]
271
- if let containerDefinition = primaryDefinitionOrDeclarationOccurrence ( ofUSR: containerSymbol. usr) {
271
+
272
+ // Use `forEachSymbolOccurrence` instead of `primaryDefinitionOrDeclarationOccurrence` to get a symbol occurrence
273
+ // for the container because it can be significantly faster: Eg. when searching for a C++ namespace (such as `llvm`),
274
+ // it may be declared in many files. Finding the canonical definition means that we would need to scan through all
275
+ // of these files. But we expect all all of these declarations to have the same parent container names and we don't
276
+ // care about locations here.
277
+ var containerDefinition : SymbolOccurrence ?
278
+ forEachSymbolOccurrence ( byUSR: containerSymbol. usr, roles: [ . definition, . declaration] ) { occurrence in
279
+ containerDefinition = occurrence
280
+ return false // stop iteration
281
+ }
282
+ if let containerDefinition {
272
283
result = self . containerNames ( of: containerDefinition) + [ containerSymbol. name]
273
284
} else {
274
285
result = [ containerSymbol. name]
You can’t perform that action at this time.
0 commit comments