Add basic reference tracking based on name lookups.

This tracks top-level qualified and unqualified lookups in the primary
source file, meaning we see all top-level names used in the file. This
is part of the intra-module dependency tracking work that can enable
incremental rebuilds.

This doesn't quite cover all of a file's dependencies. In particular, it
misses cases involving extensions  defined in terms of typealiases, and
it doesn't yet track operator lookups. The whole scheme is also very
dependent on being used to track file-level dependencies; if C is a subclass
of B and B is a subclass of A, C doesn't appear to depend on A. It only
works because changing A will mark B as dirty.

Part of rdar://problem/15353101

Swift SVN r22925
This commit is contained in:
Jordan Rose
2014-10-24 22:23:03 +00:00
parent 42011d98c8
commit fc09bd4585
13 changed files with 225 additions and 21 deletions

View File

@@ -1107,6 +1107,8 @@ static Optional<OP_DECL *>
lookupOperatorDeclForName(Module *M, SourceLoc Loc, Identifier Name,
OperatorMap<OP_DECL *> SourceFile::*OP_MAP)
{
// FIXME: Operator lookup is a kind of top-level lookup too. We should be
// tracking this in a SourceFile's ReferencedNameTracker.
OP_DECL *result = nullptr;
for (const FileUnit *File : M->getFiles()) {
auto next = lookupOperatorDeclForName(*File, Loc, Name, false, OP_MAP);