Plumb Module Fingerprints Into ModuleDepGraphFactory

This commit is contained in:
Robert Widmann
2021-02-02 09:59:08 -08:00
parent 29904e7857
commit dab204e86e
3 changed files with 23 additions and 13 deletions

View File

@@ -108,3 +108,16 @@ void AbstractSourceFileDepGraphFactory::addAUsedDecl(
assert(useNode->getIsProvides() && "Use (using node) must be a provides");
g.addArc(defNode, useNode);
}
void AbstractSourceFileDepGraphFactory::addAnExternalDependency(
const DependencyKey &defKey, const DependencyKey &useKey,
Optional<Fingerprint> maybeFP) {
auto *defNode = g.findExistingNodeOrCreateIfNew(defKey, maybeFP,
false /* = !isProvides */);
auto nullableUse = g.findExistingNode(useKey);
assert(nullableUse.isNonNull() && "Use must be an already-added provides");
auto *useNode = nullableUse.get();
assert(useNode->getIsProvides() && "Use (using node) must be a provides");
g.addArc(defNode, useNode);
}