Distinguish conformance and superclass generic requirements.

As part of this, use a different enum for parsed generic requirements.

NFC except that I noticed that ASTWalker wasn't visiting the second
type in a conformance constraint; fixing this seems to have no effect
beyond producing better IDE annotations.
This commit is contained in:
John McCall
2016-01-11 16:02:48 -08:00
parent 0b8468d36b
commit 1f3b3142b4
25 changed files with 246 additions and 196 deletions

View File

@@ -921,6 +921,7 @@ static uint8_t getRawStableRequirementKind(RequirementKind kind) {
switch (kind) {
CASE(Conformance)
CASE(Superclass)
CASE(SameType)
CASE(WitnessMarker)
}
@@ -973,7 +974,7 @@ bool Serializer::writeGenericParams(const GenericParamList *genericParams,
llvm::raw_svector_ostream ReqOS(ReqStr);
next.printAsWritten(ReqOS);
switch (next.getKind()) {
case RequirementKind::Conformance:
case RequirementReprKind::TypeConstraint:
GenericRequirementLayout::emitRecord(
Out, ScratchRecord, abbrCode,
GenericRequirementKind::Conformance,
@@ -981,7 +982,7 @@ bool Serializer::writeGenericParams(const GenericParamList *genericParams,
addTypeRef(next.getConstraint()),
ReqOS.str());
break;
case RequirementKind::SameType:
case RequirementReprKind::SameType:
GenericRequirementLayout::emitRecord(
Out, ScratchRecord, abbrCode,
GenericRequirementKind::SameType,
@@ -989,9 +990,6 @@ bool Serializer::writeGenericParams(const GenericParamList *genericParams,
addTypeRef(next.getSecondType()),
ReqOS.str());
break;
case RequirementKind::WitnessMarker:
llvm_unreachable("Can't show up in requirement representations");
break;
}
}