Start detangling the uses of TypeDecl::getProtocols(). NFC

Getting the protocols of an arbitrary type doesn't make sense, so start phasing this out by introducing specialized entry points that do make sense:
  - get the inherited protocols of a ProtocolDecl
  - get the conforming protocols for an associated type or generic
  type parameter
  - (already present) ask for the protocols to which a nominal type conforms

Swift SVN r26411
This commit is contained in:
Doug Gregor
2015-03-22 12:35:17 +00:00
parent 0d5bdd3774
commit f50ef5005c
9 changed files with 49 additions and 34 deletions

View File

@@ -54,7 +54,7 @@ static FormalLinkage
getGenericClauseLinkage(ArrayRef<GenericTypeParamDecl *> params) {
FormalLinkage result = FormalLinkage::Top;
for (auto &param : params) {
for (auto proto : param->getProtocols())
for (auto proto : param->getConformingProtocols(nullptr))
result ^= getTypeLinkage(CanType(proto->getDeclaredType()));
if (auto superclass = param->getSuperclass())
result ^= getTypeLinkage(superclass->getCanonicalType());