Skip to content

ABIChecker: add an API to document that SDKNodeRoot contains single module name. NFC #68590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/swift/APIDigester/ModuleAnalyzerNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ class SDKNodeRoot: public SDKNode {
ArrayRef<SDKNodeDecl*> getDescendantsByUsr(StringRef Usr) {
return DescendantDeclTable[Usr].getArrayRef();
}
llvm::Optional<StringRef> getSingleModuleName() const;
};

class SDKNodeType: public SDKNode {
Expand Down
7 changes: 7 additions & 0 deletions lib/APIDigester/ModuleAnalyzerNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2107,6 +2107,13 @@ void SDKNodeRoot::jsonize(json::Output &out) {
out.mapOptional(getKeyContent(Ctx, KeyKind::KK_tool_arguments).data(), ToolArgs);
}

llvm::Optional<StringRef> SDKNodeRoot::getSingleModuleName() const {
auto rawName = getName();
if (rawName == "MULTI_MODULE" || rawName == "NO_MODULE")
return llvm::None;
return rawName;
}

void SDKNodeConformance::jsonize(json::Output &out) {
SDKNode::jsonize(out);
output(out, KeyKind::KK_usr, Usr);
Expand Down