Skip to content

Commit e646ef2

Browse files
committed
Add incrementalExternalDepend as an Incremental NodeKind
1 parent 044f85a commit e646ef2

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

include/swift/Basic/ReferenceDependencyKeys.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,18 @@ enum class NodeKind {
5353
dynamicLookup,
5454
externalDepend,
5555
sourceFileProvide,
56+
incrementalExternalDepend,
5657
/// For iterating through the NodeKinds.
5758
kindCount
5859
};
5960

6061
/// Used for printing out NodeKinds to dot files, and dumping nodes for
6162
/// debugging.
6263
const std::string NodeKindNames[]{
63-
"topLevel", "nominal", "potentialMember", "member",
64-
"dynamicLookup", "externalDepend", "sourceFileProvide"};
64+
"topLevel", "nominal",
65+
"potentialMember", "member",
66+
"dynamicLookup", "externalDepend",
67+
"sourceFileProvide", "incrementalExternalDepend"};
6568
} // end namespace fine_grained_dependencies
6669
} // end namespace swift
6770

lib/AST/FineGrainedDependencies.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ std::string DependencyKey::humanReadableName() const {
231231
switch (kind) {
232232
case NodeKind::member:
233233
return demangleTypeAsContext(context) + "." + name;
234+
case NodeKind::incrementalExternalDepend:
234235
case NodeKind::externalDepend:
235236
case NodeKind::sourceFileProvide:
236237
return llvm::sys::path::filename(name).str();
@@ -261,9 +262,12 @@ raw_ostream &fine_grained_dependencies::operator<<(raw_ostream &out,
261262
bool DependencyKey::verify() const {
262263
assert((getKind() != NodeKind::externalDepend || isInterface()) &&
263264
"All external dependencies must be interfaces.");
265+
assert((getKind() != NodeKind::incrementalExternalDepend || isInterface()) &&
266+
"All incremental external dependencies must be interfaces.");
264267
switch (getKind()) {
265268
case NodeKind::topLevel:
266269
case NodeKind::dynamicLookup:
270+
case NodeKind::incrementalExternalDepend:
267271
case NodeKind::externalDepend:
268272
case NodeKind::sourceFileProvide:
269273
assert(context.empty() && !name.empty() && "Must only have a name");
@@ -294,6 +298,7 @@ void DependencyKey::verifyNodeKindNames() {
294298
CHECK_NAME(potentialMember)
295299
CHECK_NAME(member)
296300
CHECK_NAME(dynamicLookup)
301+
CHECK_NAME(incrementalExternalDepend)
297302
CHECK_NAME(externalDepend)
298303
CHECK_NAME(sourceFileProvide)
299304
case NodeKind::kindCount:

lib/AST/FrontendSourceFileDepGraphFactory.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,9 @@ class UsedDeclEnumerator {
594594
}
595595

596596
void enumerateExternalUses() {
597+
for (StringRef s : depTracker.getIncrementalDependencies())
598+
enumerateUse<NodeKind::incrementalExternalDepend>("", s);
599+
597600
for (StringRef s : depTracker.getDependencies())
598601
enumerateUse<NodeKind::externalDepend>("", s);
599602
}

lib/FrontendTool/FrontendTool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,7 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
23022302
auto *Mod = MSF.get<ModuleDecl *>();
23032303
fine_grained_dependencies::withReferenceDependencies(
23042304
Mod, *Instance.getDependencyTracker(), Mod->getModuleFilename(),
2305-
alsoEmitDotFile, [](SourceFileDepGraph &&g) {
2305+
alsoEmitDotFile, [&](SourceFileDepGraph &&g) {
23062306
serialize(MSF, serializationOpts, SM.get(), &g);
23072307
return false;
23082308
});

tools/swift-dependency-tool/swift-dependency-tool.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ void ScalarEnumerationTraits<swift::fine_grained_dependencies::NodeKind>::
9393
io.enumCase(value, "member", NodeKind::member);
9494
io.enumCase(value, "dynamicLookup", NodeKind::dynamicLookup);
9595
io.enumCase(value, "externalDepend", NodeKind::externalDepend);
96+
io.enumCase(value, "incrementalExternalDepend",
97+
NodeKind::incrementalExternalDepend);
9698
io.enumCase(value, "sourceFileProvide", NodeKind::sourceFileProvide);
9799
}
98100

unittests/Driver/UnitTestSourceFileDepGraphFactory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ UnitTestSourceFileDepGraphFactory::singleNameIsContext(const NodeKind kind) {
147147
return true;
148148
case NodeKind::topLevel:
149149
case NodeKind::dynamicLookup:
150+
case NodeKind::incrementalExternalDepend:
150151
case NodeKind::externalDepend:
151152
case NodeKind::sourceFileProvide:
152153
return false;

0 commit comments

Comments
 (0)