swift-module-digester: keep track of whether a decl overrides in the dump.

This commit is contained in:
Xi Ge
2018-09-25 11:04:55 -07:00
parent a37c1f05e2
commit c0556cc4dd
7 changed files with 202 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ struct swift::ide::api::SDKNodeInitInfo {
bool IsStatic = false;
bool IsDeprecated = false;
bool IsProtocolReq = false;
bool IsOverriding = false;
Optional<uint8_t> SelfIndex;
Optional<unsigned> FixedBinaryOrder;
ReferenceOwnership ReferenceOwnership = ReferenceOwnership::Strong;
@@ -83,6 +84,7 @@ SDKNodeDecl::SDKNodeDecl(SDKNodeInitInfo Info, SDKNodeKind Kind)
DeclAttributes(Info.DeclAttrs), IsImplicit(Info.IsImplicit),
IsStatic(Info.IsStatic), IsDeprecated(Info.IsDeprecated),
IsProtocolReq(Info.IsProtocolReq),
IsOverriding(Info.IsOverriding),
ReferenceOwnership(uint8_t(Info.ReferenceOwnership)),
GenericSig(Info.GenericSig) {}
@@ -595,6 +597,9 @@ SDKNode* SDKNode::constructSDKNode(SDKContext &Ctx,
case KeyKind::KK_deprecated:
Info.IsDeprecated = true;
break;
case KeyKind::KK_overriding:
Info.IsOverriding = true;
break;
case KeyKind::KK_protocolReq:
Info.IsProtocolReq = true;
break;
@@ -1068,6 +1073,7 @@ SDKNodeInitInfo::SDKNodeInitInfo(SDKContext &Ctx, ValueDecl *VD)
IsStatic(VD->isStatic()),
IsDeprecated(VD->getAttrs().getDeprecated(VD->getASTContext())),
IsProtocolReq(isa<ProtocolDecl>(VD->getDeclContext()) && VD->isProtocolRequirement()),
IsOverriding(VD->getOverriddenDecl()),
SelfIndex(getSelfIndex(VD)), FixedBinaryOrder(getFixedBinaryOrder(VD)),
ReferenceOwnership(getReferenceOwnership(VD)),
GenericSig(printGenericSignature(Ctx, VD)) {
@@ -1493,6 +1499,11 @@ struct ObjectTraits<SDKNode *> {
out.mapRequired(getKeyContent(Ctx, KeyKind::KK_protocolReq).data(),
isProtocolReq);
}
if (bool isOverriding = D->isOverriding()) {
out.mapRequired(getKeyContent(Ctx, KeyKind::KK_overriding).data(),
isOverriding);
}
if (bool isImplicit = D->isImplicit())
out.mapRequired(getKeyContent(Ctx, KeyKind::KK_implicit).data(),
isImplicit);