Skip to content

Commit 2cb22f5

Browse files
authored
Merge pull request #68590 from nkcsgexi/api-document-module
2 parents e7e4c14 + 49eefc0 commit 2cb22f5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/swift/APIDigester/ModuleAnalyzerNodes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ class SDKNodeRoot: public SDKNode {
446446
ArrayRef<SDKNodeDecl*> getDescendantsByUsr(StringRef Usr) {
447447
return DescendantDeclTable[Usr].getArrayRef();
448448
}
449+
llvm::Optional<StringRef> getSingleModuleName() const;
449450
};
450451

451452
class SDKNodeType: public SDKNode {

lib/APIDigester/ModuleAnalyzerNodes.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,6 +2107,13 @@ void SDKNodeRoot::jsonize(json::Output &out) {
21072107
out.mapOptional(getKeyContent(Ctx, KeyKind::KK_tool_arguments).data(), ToolArgs);
21082108
}
21092109

2110+
llvm::Optional<StringRef> SDKNodeRoot::getSingleModuleName() const {
2111+
auto rawName = getName();
2112+
if (rawName == "MULTI_MODULE" || rawName == "NO_MODULE")
2113+
return llvm::None;
2114+
return rawName;
2115+
}
2116+
21102117
void SDKNodeConformance::jsonize(json::Output &out) {
21112118
SDKNode::jsonize(out);
21122119
output(out, KeyKind::KK_usr, Usr);

0 commit comments

Comments
 (0)