mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #26727 from nkcsgexi/version-abi-checker
ABI/API checker: add a version number for the json descriptors of APIs
This commit is contained in:
@@ -79,7 +79,9 @@ void SDKNodeRoot::registerDescendant(SDKNode *D) {
|
||||
SDKNode::SDKNode(SDKNodeInitInfo Info, SDKNodeKind Kind): Ctx(Info.Ctx),
|
||||
Name(Info.Name), PrintedName(Info.PrintedName), TheKind(unsigned(Kind)) {}
|
||||
|
||||
SDKNodeRoot::SDKNodeRoot(SDKNodeInitInfo Info): SDKNode(Info, SDKNodeKind::Root) {}
|
||||
SDKNodeRoot::SDKNodeRoot(SDKNodeInitInfo Info): SDKNode(Info, SDKNodeKind::Root),
|
||||
ToolArgs(Info.ToolArgs),
|
||||
JsonFormatVer(Info.JsonFormatVer.hasValue() ? *Info.JsonFormatVer : DIGESTER_JSON_DEFAULT_VERSION) {}
|
||||
|
||||
SDKNodeDecl::SDKNodeDecl(SDKNodeInitInfo Info, SDKNodeKind Kind)
|
||||
: SDKNode(Info, Kind), DKind(Info.DKind), Usr(Info.Usr),
|
||||
@@ -367,6 +369,8 @@ SDKNode *SDKNodeRoot::getInstance(SDKContext &Ctx) {
|
||||
SDKNodeInitInfo Info(Ctx);
|
||||
Info.Name = Ctx.buffer("TopLevel");
|
||||
Info.PrintedName = Ctx.buffer("TopLevel");
|
||||
Info.ToolArgs = Ctx.getOpts().ToolArgs;
|
||||
Info.JsonFormatVer = DIGESTER_JSON_VERSION;
|
||||
return Info.createSDKNode(SDKNodeKind::Root);
|
||||
}
|
||||
|
||||
@@ -1834,6 +1838,13 @@ void SDKNode::jsonize(json::Output &out) {
|
||||
out.mapOptional(getKeyContent(Ctx, KeyKind::KK_children).data(), Children);
|
||||
}
|
||||
|
||||
void SDKNodeRoot::jsonize(json::Output &out) {
|
||||
SDKNode::jsonize(out);
|
||||
out.mapRequired(getKeyContent(Ctx, KeyKind::KK_json_format_version).data(), JsonFormatVer);
|
||||
if (!Ctx.getOpts().AvoidToolArgs)
|
||||
out.mapOptional(getKeyContent(Ctx, KeyKind::KK_tool_arguments).data(), ToolArgs);
|
||||
}
|
||||
|
||||
void SDKNodeConformance::jsonize(json::Output &out) {
|
||||
SDKNode::jsonize(out);
|
||||
output(out, KeyKind::KK_usr, Usr);
|
||||
|
||||
Reference in New Issue
Block a user