mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
also add sourceOrigin for local protocols without docs
This commit is contained in:
@@ -36,6 +36,15 @@ const ValueDecl *getForeignProtocolRequirement(const ValueDecl *VD, const Module
|
||||
requirements.pop();
|
||||
}
|
||||
}
|
||||
|
||||
const ValueDecl *getProtocolRequirement(const ValueDecl *VD) {
|
||||
auto reqs = VD->getSatisfiedProtocolRequirements();
|
||||
|
||||
if (!reqs.empty())
|
||||
return reqs.front();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
void Edge::serialize(llvm::json::OStream &OS) const {
|
||||
@@ -82,7 +91,6 @@ void Edge::serialize(llvm::json::OStream &OS) const {
|
||||
if (const auto *ID = Source.getDeclInheritingDocs())
|
||||
InheritingDecl = ID;
|
||||
|
||||
|
||||
if (!InheritingDecl && Source.getSynthesizedBaseTypeDecl())
|
||||
InheritingDecl = Source.getSymbolDecl();
|
||||
|
||||
@@ -90,7 +98,12 @@ void Edge::serialize(llvm::json::OStream &OS) const {
|
||||
if (const auto *ID = getForeignProtocolRequirement(Source.getSymbolDecl(), &Graph->M))
|
||||
InheritingDecl = ID;
|
||||
}
|
||||
|
||||
|
||||
if (!InheritingDecl) {
|
||||
if (const auto *ID = getProtocolRequirement(Source.getSymbolDecl()))
|
||||
InheritingDecl = ID;
|
||||
}
|
||||
|
||||
// If our source symbol is a inheriting decl, write in information about
|
||||
// where it's inheriting docs from.
|
||||
if (InheritingDecl) {
|
||||
|
||||
Reference in New Issue
Block a user