@@ -325,7 +325,7 @@ class BiIndexedTwoStageMap {
325
325
// / Write out the .swiftdeps file for a frontend compilation of a primary file.
326
326
bool emitReferenceDependencies (DiagnosticEngine &diags, SourceFile *SF,
327
327
const DependencyTracker &depTracker,
328
- StringRef outputPath, bool alsoEmitDotFile );
328
+ StringRef outputPath);
329
329
// ==============================================================================
330
330
// MARK: Enums
331
331
// ==============================================================================
@@ -438,8 +438,8 @@ class DependencyKey {
438
438
name () {}
439
439
440
440
// / For constructing a key in the frontend.
441
- DependencyKey (NodeKind kind, DeclAspect aspect, const std::string & context,
442
- const std::string & name)
441
+ DependencyKey (NodeKind kind, DeclAspect aspect, std::string context,
442
+ std::string name)
443
443
: kind(kind), aspect(aspect), context(context), name(name) {
444
444
assert (verify ());
445
445
}
@@ -449,7 +449,7 @@ class DependencyKey {
449
449
StringRef getContext () const { return context; }
450
450
StringRef getName () const { return name; }
451
451
452
- StringRef getSwiftDepsFromASourceFileProvideNodeKey () const {
452
+ StringRef getSwiftDepsFromSourceFileProvide () const {
453
453
assert (getKind () == NodeKind::sourceFileProvide &&
454
454
" Receiver must be sourceFileProvide." );
455
455
return getName ();
@@ -494,19 +494,11 @@ class DependencyKey {
494
494
static std::string computeNameForProvidedEntity (Entity);
495
495
496
496
// / Given some type of depended-upon entity create the key.
497
- static DependencyKey createDependedUponKey (StringRef mangledHolderName,
498
- StringRef memberBaseName);
499
-
500
- template <NodeKind kind>
501
- static DependencyKey createDependedUponKey (StringRef);
502
-
503
- static DependencyKey
504
- createTransitiveKeyForWholeSourceFile (StringRef swiftDeps);
497
+ template <NodeKind kind, typename Entity>
498
+ static DependencyKey createDependedUponKey (const Entity &);
505
499
506
500
std::string humanReadableName () const ;
507
501
508
- StringRef aspectName () const { return DeclAspectNames[size_t (aspect)]; }
509
-
510
502
void dump (llvm::raw_ostream &os) const { os << asString () << " \n " ; }
511
503
SWIFT_DEBUG_DUMP { dump (llvm::errs ()); }
512
504
@@ -543,13 +535,6 @@ struct std::hash<typename swift::fine_grained_dependencies::DeclAspect> {
543
535
}
544
536
};
545
537
546
- namespace swift {
547
- namespace fine_grained_dependencies {
548
- using ContextNameFingerprint =
549
- std::tuple<std::string, std::string, Optional<std::string>>;
550
- }
551
- } // namespace swift
552
-
553
538
// ==============================================================================
554
539
// MARK: DepGraphNode
555
540
// ==============================================================================
@@ -699,9 +684,6 @@ class SourceFileDepGraphNode : public DepGraphNode {
699
684
}
700
685
701
686
// / Record the sequence number, \p n, of another use.
702
- // / The relationship between an interface and its implementation is NOT
703
- // / included here. See \c
704
- // / SourceFileDepGraph::findExistingNodePairOrCreateAndAddIfNew.
705
687
void addDefIDependUpon (size_t n) {
706
688
if (n != getSequenceNumber ())
707
689
defsIDependUpon.insert (n);
@@ -745,25 +727,6 @@ class SourceFileDepGraph {
745
727
SourceFileDepGraph (const SourceFileDepGraph &g) = delete ;
746
728
SourceFileDepGraph (SourceFileDepGraph &&g) = default ;
747
729
748
- // / Simulate loading for unit testing:
749
- // / \param swiftDepsFileName The name of the swiftdeps file of the phony job
750
- // / \param includePrivateDeps Whether the graph includes intra-file arcs
751
- // / \param hadCompilationError Simulate a compilation error
752
- // / \param interfaceHash The interface hash of the simulated graph
753
- // / \param simpleNamesByRDK A map of vectors of names keyed by reference
754
- // / dependency key \param compoundNamesByRDK A map of (mangledHolder,
755
- // / baseName) pairs keyed by reference dependency key. For single-name
756
- // / dependencies, an initial underscore indicates that the name does not
757
- // / cascade. For compound names, it is the first name, the holder which
758
- // / indicates non-cascading. For member names, an initial underscore indicates
759
- // / file-privacy.
760
- static SourceFileDepGraph
761
- simulateLoad (std::string swiftDepsFileName, const bool includePrivateDeps,
762
- const bool hadCompilationError, std::string interfaceHash,
763
- llvm::StringMap<std::vector<std::string>> simpleNamesByRDK,
764
- llvm::StringMap<std::vector<std::pair<std::string, std::string>>>
765
- compoundNamesByRDK);
766
-
767
730
// / Nodes are owned by the graph.
768
731
~SourceFileDepGraph () {
769
732
forEachNode ([&](SourceFileDepGraphNode *n) { delete n; });
@@ -783,7 +746,7 @@ class SourceFileDepGraph {
783
746
InterfaceAndImplementationPair<SourceFileDepGraphNode>
784
747
getSourceFileNodePair () const ;
785
748
786
- StringRef getSwiftDepsOfJobThatProducedThisGraph () const ;
749
+ StringRef getSwiftDepsFromSourceFileProvide () const ;
787
750
788
751
std::string getGraphID () const {
789
752
return getSourceFileNodePair ().getInterface ()->getKey ().humanReadableName ();
@@ -807,13 +770,12 @@ class SourceFileDepGraph {
807
770
// / The frontend creates a pair of nodes for every tracked Decl and the source
808
771
// / file itself.
809
772
InterfaceAndImplementationPair<SourceFileDepGraphNode>
810
- findExistingNodePairOrCreateAndAddIfNew (
811
- NodeKind k, const ContextNameFingerprint &contextNameFingerprint);
773
+ findExistingNodePairOrCreateAndAddIfNew (NodeKind k, StringRef context,
774
+ StringRef name,
775
+ Optional<std::string> fingerprint);
812
776
813
- SourceFileDepGraphNode *
814
- findExistingNodeOrCreateIfNew (DependencyKey key,
815
- const Optional<std::string> &fingerprint,
816
- bool isProvides);
777
+ SourceFileDepGraphNode *findExistingNodeOrCreateIfNew (
778
+ DependencyKey key, Optional<std::string> fingerprint, bool isProvides);
817
779
818
780
// / \p Use is the Node that must be rebuilt when \p def changes.
819
781
// / Record that fact in the graph.
@@ -930,7 +892,7 @@ template <typename GraphT> class DotFileEmitter {
930
892
}
931
893
void emitArcs () {
932
894
g.forEachArc ([&](const NodeT *def, const NodeT *use) {
933
- if (includeGraphArc (def, use ))
895
+ if (includeGraphArc (use, def ))
934
896
emitGraphArc (def, use);
935
897
});
936
898
}
0 commit comments