SymbolGraph: Don't unconditionally add edge targets to the graph

Edge targets might point outside the module, so don't include them
unconditionally.

rdar://58876107
This commit is contained in:
Ashley Garland
2020-02-10 10:49:09 -08:00
parent 7190073a85
commit 58bbe1ec04
2 changed files with 12 additions and 1 deletions

View File

@@ -139,7 +139,12 @@ void SymbolGraph::recordEdge(const ValueDecl *Source,
}
Nodes.insert(Source);
Nodes.insert(Target);
if (Target->getModuleContext() != &M) {
// Don't claim a symbol just because we have a relationship to it.
// For example, if we conform to `Sequence`, that symbol's node should be
// under Swift, not this module.
Nodes.insert(Target);
}
Edges.insert({this, Kind, Source, Target});
}