Skip to content

Commit 1b7c713

Browse files
committed
[NFC] Only Register Primaries As Dependency Sources
Now that the top-level source file is the only dependency source that matters, the only case that matters is when request evaluation enters a primary file. For non-primaries, there will be no corresponding swiftdeps file to emit references into, so we're just wasting time and memory keeping track of anything that happens there. This is only possible after we removed cascading dependencies because unqualified lookups had to be charged to the files they originated in. Now, we charge those lookups to the primary that initiated the request.
1 parent 78e78a2 commit 1b7c713

File tree

2 files changed

+2
-75
lines changed

2 files changed

+2
-75
lines changed

include/swift/AST/EvaluatorDependencies.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace detail {
3333
template <typename...> using void_t = void;
3434
} // namespace detail
3535

36-
// A \c DependencySource is currently defined to be a parent source file.
36+
// A \c DependencySource is currently defined to be a primary source file.
3737
//
3838
// The \c SourceFile instance is an artifact of the current dependency system,
3939
// and should be scrapped if possible. It currently encodes the idea that
@@ -281,7 +281,7 @@ struct DependencyRecorder {
281281
auto Source = Req.readDependencySource(coll);
282282
// If there is no source to introduce, bail. This can occur if
283283
// a request originates in the context of a module.
284-
if (Source.isNull()) {
284+
if (Source.isNull() || !Source.get()->isPrimary()) {
285285
return;
286286
}
287287
coll.dependencySources.emplace_back(Source);

test/Incremental/Verifier/single-file/AnyObject.swift

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)