If I may, I have another implementation-level suggestion. So far we have three places in our code where given a nominal type, we wish to visit all of its superclasses, conforming protocols, and any protocols they refine, and so on:
- CSSimplify.cpp, getDynamicCallableMethods()
- CSSimplify.cpp, hasDynamicMemberLookupAttribute()
- NameLookup.cpp, lookupQualified()
(There might be others actually; these are the three I'm aware of).
I'm assuming you'll be adding a fourth, to find your CallDecls for a given base type. It would be nice to extract this into a common utility; perhaps a method on DeclContext that takes an llvm::function_ref() tp call at each step would suffice.