Skip to content

Commit 85947ca

Browse files
committed
[NFC] Pull addAllDefinedDeclsOfAGivenType into its Base Class
1 parent e29c19c commit 85947ca

File tree

3 files changed

+13
-38
lines changed

3 files changed

+13
-38
lines changed

include/swift/AST/AbstractSourceFileDepGraphFactory.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,19 @@ class AbstractSourceFileDepGraphFactory {
6666
virtual void addAllUsedDecls() = 0;
6767

6868
protected:
69+
/// Given an array of Decls or pairs of them in \p declsOrPairs
70+
/// create node pairs for context and name
71+
template <NodeKind kind, typename ContentsT>
72+
void addAllDefinedDeclsOfAGivenType(std::vector<ContentsT> &contentsVec) {
73+
for (const auto &declOrPair : contentsVec) {
74+
Optional<std::string> fp =
75+
AbstractSourceFileDepGraphFactory::getFingerprintIfAny(declOrPair);
76+
addADefinedDecl(
77+
DependencyKey::createForProvidedEntityInterface<kind>(declOrPair),
78+
fp ? StringRef(fp.getValue()) : Optional<StringRef>());
79+
}
80+
}
81+
6982
/// Add an pair of interface, implementation nodes to the graph, which
7083
/// represent some \c Decl defined in this source file. \param key the
7184
/// interface key of the pair

lib/AST/FrontendSourceFileDepGraphFactory.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -408,20 +408,6 @@ void FrontendSourceFileDepGraphFactory::addAllDefinedDecls() {
408408
declFinder.classMembers);
409409
}
410410

411-
/// Given an array of Decls or pairs of them in \p declsOrPairs
412-
/// create node pairs for context and name
413-
template <NodeKind kind, typename ContentsT>
414-
void FrontendSourceFileDepGraphFactory::addAllDefinedDeclsOfAGivenType(
415-
std::vector<ContentsT> &contentsVec) {
416-
for (const auto &declOrPair : contentsVec) {
417-
Optional<std::string> fp =
418-
AbstractSourceFileDepGraphFactory::getFingerprintIfAny(declOrPair);
419-
addADefinedDecl(
420-
DependencyKey::createForProvidedEntityInterface<kind>(declOrPair),
421-
fp ? StringRef(fp.getValue()) : Optional<StringRef>());
422-
}
423-
}
424-
425411
//==============================================================================
426412
// MARK: FrontendSourceFileDepGraphFactory - adding collections of used Decls
427413
//==============================================================================
@@ -565,17 +551,3 @@ void ModuleDepGraphFactory::addAllDefinedDecls() {
565551
addAllDefinedDeclsOfAGivenType<NodeKind::dynamicLookup>(
566552
declFinder.classMembers);
567553
}
568-
569-
/// Given an array of Decls or pairs of them in \p declsOrPairs
570-
/// create node pairs for context and name
571-
template <NodeKind kind, typename ContentsT>
572-
void ModuleDepGraphFactory::addAllDefinedDeclsOfAGivenType(
573-
std::vector<ContentsT> &contentsVec) {
574-
for (const auto &declOrPair : contentsVec) {
575-
Optional<std::string> fp =
576-
AbstractSourceFileDepGraphFactory::getFingerprintIfAny(declOrPair);
577-
addADefinedDecl(
578-
DependencyKey::createForProvidedEntityInterface<kind>(declOrPair),
579-
fp ? StringRef(fp.getValue()) : Optional<StringRef>());
580-
}
581-
}

lib/AST/FrontendSourceFileDepGraphFactory.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ class FrontendSourceFileDepGraphFactory
3939

4040
void addAllDefinedDecls() override;
4141
void addAllUsedDecls() override;
42-
43-
/// Given an array of Decls or pairs of them in \p declsOrPairs
44-
/// create node pairs for context and name
45-
template <NodeKind kind, typename ContentsT>
46-
void addAllDefinedDeclsOfAGivenType(std::vector<ContentsT> &contentsVec);
4742
};
4843

4944
class ModuleDepGraphFactory : public AbstractSourceFileDepGraphFactory {
@@ -57,11 +52,6 @@ class ModuleDepGraphFactory : public AbstractSourceFileDepGraphFactory {
5752
private:
5853
void addAllDefinedDecls() override;
5954
void addAllUsedDecls() override {}
60-
61-
/// Given an array of Decls or pairs of them in \p declsOrPairs
62-
/// create node pairs for context and name
63-
template <NodeKind kind, typename ContentsT>
64-
void addAllDefinedDeclsOfAGivenType(std::vector<ContentsT> &contentsVec);
6555
};
6656

6757
} // namespace fine_grained_dependencies

0 commit comments

Comments
 (0)