lib/IRGen/GenMeta.cpp
SpecialProtocol irgen::getSpecialProtocolID(ProtocolDecl *P) {
  auto known = P->getKnownProtocolKind();
  if (!known)
    return SpecialProtocol::None;
  switch (*known) {
  case KnownProtocolKind::Error:
    return SpecialProtocol::Error;
    
  // The other known protocols aren't special at runtime.
  case KnownProtocolKind::Sequence:
  case KnownProtocolKind::IteratorProtocol:
  case KnownProtocolKind::RawRepresentable:
  case KnownProtocolKind::Equatable:
  case KnownProtocolKind::Hashable:
  case KnownProtocolKind::Comparable:
  case KnownProtocolKind::ObjectiveCBridgeable:
  case KnownProtocolKind::DestructorSafeContainer:
  case KnownProtocolKind::SwiftNewtypeWrapper:
  case KnownProtocolKind::ExpressibleByArrayLiteral:
  case KnownProtocolKind::ExpressibleByBooleanLiteral:
  case KnownProtocolKind::ExpressibleByDictionaryLiteral:
  case KnownProtocolKind::ExpressibleByExtendedGraphemeClusterLiteral:
  case KnownProtocolKind::ExpressibleByFloatLiteral:
  case KnownProtocolKind::ExpressibleByIntegerLiteral:
  case KnownProtocolKind::ExpressibleByStringInterpolation:
  case KnownProtocolKind::ExpressibleByStringLiteral:
  case KnownProtocolKind::ExpressibleByNilLiteral:
  case KnownProtocolKind::ExpressibleByUnicodeScalarLiteral:
  case KnownProtocolKind::ExpressibleByColorLiteral:
  case KnownProtocolKind::ExpressibleByImageLiteral:
  case KnownProtocolKind::ExpressibleByFileReferenceLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinBooleanLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinUTF16ExtendedGraphemeClusterLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinExtendedGraphemeClusterLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinFloatLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinIntegerLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinStringLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinUTF16StringLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinUnicodeScalarLiteral:
  case KnownProtocolKind::OptionSet:
  case KnownProtocolKind::BridgedNSError:
  case KnownProtocolKind::BridgedStoredNSError:
  case KnownProtocolKind::CFObject:
  case KnownProtocolKind::ErrorCodeProtocol:
  case KnownProtocolKind::ExpressibleByBuiltinConstStringLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinConstUTF16StringLiteral:
  case KnownProtocolKind::CodingKey:
  case KnownProtocolKind::Encodable:
  case KnownProtocolKind::Decodable:
    return SpecialProtocol::None;
  }

  llvm_unreachable("Not a valid KnownProtocolKind.");
}
/// Get the runtime identifier for a special protocol, if any.
Get the runtime identifier for a special protocol, if any.
Get the runtime identifier for a special protocol if any .
SpecialProtocol irgen::getSpecialProtocolID(ProtocolDecl *P) {
  auto known = P->getKnownProtocolKind();
  if (!known)
    return SpecialProtocol::None;
  switch (*known) {
  case KnownProtocolKind::Error:
    return SpecialProtocol::Error;
  case KnownProtocolKind::Sequence:
  case KnownProtocolKind::IteratorProtocol:
  case KnownProtocolKind::RawRepresentable:
  case KnownProtocolKind::Equatable:
  case KnownProtocolKind::Hashable:
  case KnownProtocolKind::Comparable:
  case KnownProtocolKind::ObjectiveCBridgeable:
  case KnownProtocolKind::DestructorSafeContainer:
  case KnownProtocolKind::SwiftNewtypeWrapper:
  case KnownProtocolKind::ExpressibleByArrayLiteral:
  case KnownProtocolKind::ExpressibleByBooleanLiteral:
  case KnownProtocolKind::ExpressibleByDictionaryLiteral:
  case KnownProtocolKind::ExpressibleByExtendedGraphemeClusterLiteral:
  case KnownProtocolKind::ExpressibleByFloatLiteral:
  case KnownProtocolKind::ExpressibleByIntegerLiteral:
  case KnownProtocolKind::ExpressibleByStringInterpolation:
  case KnownProtocolKind::ExpressibleByStringLiteral:
  case KnownProtocolKind::ExpressibleByNilLiteral:
  case KnownProtocolKind::ExpressibleByUnicodeScalarLiteral:
  case KnownProtocolKind::ExpressibleByColorLiteral:
  case KnownProtocolKind::ExpressibleByImageLiteral:
  case KnownProtocolKind::ExpressibleByFileReferenceLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinBooleanLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinUTF16ExtendedGraphemeClusterLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinExtendedGraphemeClusterLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinFloatLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinIntegerLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinStringLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinUTF16StringLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinUnicodeScalarLiteral:
  case KnownProtocolKind::OptionSet:
  case KnownProtocolKind::BridgedNSError:
  case KnownProtocolKind::BridgedStoredNSError:
  case KnownProtocolKind::CFObject:
  case KnownProtocolKind::ErrorCodeProtocol:
  case KnownProtocolKind::ExpressibleByBuiltinConstStringLiteral:
  case KnownProtocolKind::ExpressibleByBuiltinConstUTF16StringLiteral:
  case KnownProtocolKind::CodingKey:
  case KnownProtocolKind::Encodable:
  case KnownProtocolKind::Decodable:
    return SpecialProtocol::None;
  }
  llvm_unreachable("Not a valid KnownProtocolKind.");
}
SpecialProtocol irgen :: getSpecialProtocolID ( ProtocolDecl * P ) { auto known = P -> getKnownProtocolKind ( ) ; if ( ! known ) return SpecialProtocol :: None ; switch ( * known ) { case KnownProtocolKind :: Error : return SpecialProtocol :: Error ; case KnownProtocolKind :: Sequence : case KnownProtocolKind :: IteratorProtocol : case KnownProtocolKind :: RawRepresentable : case KnownProtocolKind :: Equatable : case KnownProtocolKind :: Hashable : case KnownProtocolKind :: Comparable : case KnownProtocolKind :: ObjectiveCBridgeable : case KnownProtocolKind :: DestructorSafeContainer : case KnownProtocolKind :: SwiftNewtypeWrapper : case KnownProtocolKind :: ExpressibleByArrayLiteral : case KnownProtocolKind :: ExpressibleByBooleanLiteral : case KnownProtocolKind :: ExpressibleByDictionaryLiteral : case KnownProtocolKind :: ExpressibleByExtendedGraphemeClusterLiteral : case KnownProtocolKind :: ExpressibleByFloatLiteral : case KnownProtocolKind :: ExpressibleByIntegerLiteral : case KnownProtocolKind :: ExpressibleByStringInterpolation : case KnownProtocolKind :: ExpressibleByStringLiteral : case KnownProtocolKind :: ExpressibleByNilLiteral : case KnownProtocolKind :: ExpressibleByUnicodeScalarLiteral : case KnownProtocolKind :: ExpressibleByColorLiteral : case KnownProtocolKind :: ExpressibleByImageLiteral : case KnownProtocolKind :: ExpressibleByFileReferenceLiteral : case KnownProtocolKind :: ExpressibleByBuiltinBooleanLiteral : case KnownProtocolKind :: ExpressibleByBuiltinUTF16ExtendedGraphemeClusterLiteral : case KnownProtocolKind :: ExpressibleByBuiltinExtendedGraphemeClusterLiteral : case KnownProtocolKind :: ExpressibleByBuiltinFloatLiteral : case KnownProtocolKind :: ExpressibleByBuiltinIntegerLiteral : case KnownProtocolKind :: ExpressibleByBuiltinStringLiteral : case KnownProtocolKind :: ExpressibleByBuiltinUTF16StringLiteral : case KnownProtocolKind :: ExpressibleByBuiltinUnicodeScalarLiteral : case KnownProtocolKind :: OptionSet : case KnownProtocolKind :: BridgedNSError : case KnownProtocolKind :: BridgedStoredNSError : case KnownProtocolKind :: CFObject : case KnownProtocolKind :: ErrorCodeProtocol : case KnownProtocolKind :: ExpressibleByBuiltinConstStringLiteral : case KnownProtocolKind :: ExpressibleByBuiltinConstUTF16StringLiteral : case KnownProtocolKind :: CodingKey : case KnownProtocolKind :: Encodable : case KnownProtocolKind :: Decodable : return SpecialProtocol :: None ; } llvm_unreachable ( " " ) ; }
Get the runtime identifier for a special protocol, if any.
Get the runtime identifier for a special protocol if any .
// The other known protocols aren't special at runtime.