swift-api-digester: don't assume super classes are always present in the module dump.

When we compare the APIs of entire SDKs, we can assume super classes
are always present in the API dump. However, this assumption is invalid
for framework-level API diff checking, where super classes can come from
other modules whose contents are not serialized.

rdar://33110442
This commit is contained in:
Xi Ge
2017-07-06 11:49:42 -07:00
parent e4de4ea9de
commit 2b05e30756
5 changed files with 20 additions and 7 deletions

View File

@@ -729,8 +729,10 @@ public:
Optional<SDKNodeTypeDecl*> getSuperclass() const {
if (SuperclassUsr.empty())
return None;
return (*getRootNode()->getDescendantByUsr(SuperclassUsr))->
getAs<SDKNodeTypeDecl>();
if (auto SC = getRootNode()->getDescendantByUsr(SuperclassUsr)) {
return (*SC)->getAs<SDKNodeTypeDecl>();
}
return None;
}
/// Finding the node through all children, including the inheritted ones,