swift-module-digester: diagnose type witness type changes when checking ABI stability.

This commit is contained in:
Xi Ge
2018-10-25 16:37:42 -07:00
parent e7c2bf0ab9
commit 49c16922dd
9 changed files with 44 additions and 2 deletions

View File

@@ -326,7 +326,7 @@ StringRef SDKNodeType::getParamValueOwnership() const {
StringRef SDKNodeType::getTypeRoleDescription() const {
assert(isTopLevelType());
auto P = cast<SDKNodeDecl>(getParent());
auto P = getParent();
switch(P->getKind()) {
case SDKNodeKind::Root:
case SDKNodeKind::TypeNominal:
@@ -335,7 +335,6 @@ StringRef SDKNodeType::getTypeRoleDescription() const {
case SDKNodeKind::DeclType:
case SDKNodeKind::DeclOperator:
case SDKNodeKind::Conformance:
case SDKNodeKind::TypeWitness:
llvm_unreachable("Type Parent is wrong");
case SDKNodeKind::DeclFunction:
case SDKNodeKind::DeclConstructor:
@@ -350,6 +349,8 @@ StringRef SDKNodeType::getTypeRoleDescription() const {
return "underlying";
case SDKNodeKind::DeclAssociatedType:
return "default";
case SDKNodeKind::TypeWitness:
return "type witness type";
}
}
@@ -440,6 +441,11 @@ SDKNodeType *SDKNodeTypeWitness::getUnderlyingType() const {
return getOnlyChild()->getAs<SDKNodeType>();
}
StringRef SDKNodeTypeWitness::getWitnessedTypeName() const {
return Ctx.buffer((llvm::Twine(getParent()->getAs<SDKNodeConformance>()->
getName()) + "." + getName()).str());
}
Optional<SDKNodeDeclType*> SDKNodeDeclType::getSuperclass() const {
if (SuperclassUsr.empty())
return None;