Simplify the interface to Module::lookupConformance.

Rather than returning a weird PointerIntPair, return an
Optional<ProtocolConformanceRef>. NFC
This commit is contained in:
Doug Gregor
2016-03-15 22:07:14 -07:00
parent b051c5a70f
commit a31edf53d0
15 changed files with 122 additions and 175 deletions

View File

@@ -3605,13 +3605,7 @@ ASTContext::getBridgedToObjC(const DeclContext *dc, Type type,
// Check whether the type conforms to _BridgedToObjectiveC.
auto conformance
= dc->getParentModule()->lookupConformance(type, bridgedProto, resolver);
switch (conformance.getInt()) {
case ConformanceKind::Conforms:
// The type conforms, and we know the conformance, so we can look up the
// bridged type below.
break;
case ConformanceKind::DoesNotConform:
if (!conformance) {
// If we haven't imported Foundation but this is a whitelisted type,
// behave as above.
if (knownBridgedToObjC)
@@ -3621,7 +3615,7 @@ ASTContext::getBridgedToObjC(const DeclContext *dc, Type type,
// Find the type we bridge to.
return ProtocolConformance::getTypeWitnessByName(type,
conformance.getPointer(),
conformance->getConcrete(),
getIdentifier("_ObjectiveCType"),
resolver);
}