gather

fun DeclarationDescriptor.gather(predicate: (DeclarationDescriptor) -> Boolean): List<DeclarationDescriptor>
fun ModuleDescriptor.gather(initialPackages: List<FqName> = listOf(FqName("")), addSubPackages: Boolean, predicate: (DeclarationDescriptor) -> Boolean): List<DeclarationDescriptor>

Gather all descriptors which satisfy a predicate, going inside every element recursively.