Commit Graph

64 Commits

Author SHA1 Message Date
Jordan Rose
cb1bf10f81 Dependencies: Fix bug involving nested DeclContexts.
Previously we would fail to find something in a private context, jump up
to a public context, and decide that the dependency was now non-private.

Swift SVN r23482
2014-11-20 20:58:16 +00:00
Jordan Rose
ce995a8f67 Dependencies: conformances on private decls are themselves private.
This does reveal an overly conservative case: lookup in the inheritance
clause of extensions is always considered a non-private lookup, even if
it's extending a private type, because we haven't yet resolved what it's
extending. Won't lead to incorrect behavior, just more compilation than
is strictly necessary.

Swift SVN r23481
2014-11-20 20:58:15 +00:00
Jordan Rose
6e7d291ee6 Dependencies: inherited protocols on a private protocol are private deps.
Start with the easiest cases and work upwards!

Swift SVN r23480
2014-11-20 20:58:13 +00:00
Jordan Rose
922754810a Dependencies: make sure operator dependencies are recorded properly.
Previously we could fail to capture dependencies on other modules. Why is
this a problem? Because a file in the main module could introduce a new
operator decl with the same name (at least in theory).

Swift SVN r23448
2014-11-19 22:28:31 +00:00
Jordan Rose
c712c51d4a Dependencies: start tracking whether a lookup is private to a file or not.
This is sort of two commits squashed into one: first, update
ReferencedNameTracker to record whether a name or type is non-private,
along with changing all clients to assume non-private; and second,
actually try to (conservatively) decide if a particular unqualified lookup can
be considered private.

What does "private" mean? That means that a dependency does not affect
"downstream" files. For example, if file A depends on B, and B depends on C,
then a change in C normally means A will get rebuilt. But if B's dependencies
on C are all private dependencies (e.g. lookups from within function bodies),
then A does not need to be rebuilt.

In practice there are several rules about when we can make this assumption,
and a few places where our current DeclContext model is not good enough to
distinguish private uses from non-private uses. In these cases we have to
be conservative and assume that the use is non-private (and thus that
downstream files will need to be rebuilt).

Part of rdar://problem/15353101

Swift SVN r23447
2014-11-19 22:28:30 +00:00
Jordan Rose
6961c08b47 Dependencies: use of a conformance is a use of the conforming type.
...even if we don't explicitly do any lookups into the type.

Part of rdar://problem/15353101

Swift SVN r23393
2014-11-18 01:38:20 +00:00
Jordan Rose
22c41e005b Add adopted protocols to the type dependency list.
This isn't so interesting because we already depend on the top-level name
of a protocol, but it becomes more interesting if/when we start allowing
protocol extensions.

Part of rdar://problem/15353101

Swift SVN r23392
2014-11-18 01:38:19 +00:00
Jordan Rose
d6c7c522a7 Add operator lookups to the set of top-level names being used.
Part of rdar://problem/15353101

Swift SVN r22931
2014-10-24 22:23:09 +00:00
Jordan Rose
2b47f3e7ec Emit the list of nominals declared or extended in the primary file.
This is part of the intra-module dependency tracking work to implement
incremental rebuilds.

Part of rdar://problem/15353101

Swift SVN r22930
2014-10-24 22:23:08 +00:00
Jordan Rose
e65478608b Change temporary "swiftdeps" format to be YAML-compatible.
No real functionality change. This just lets me play with the data in Ruby
more easily.

Swift SVN r22929
2014-10-24 22:23:07 +00:00
Jordan Rose
241a6277a9 The list of decls provided by a file should not include private decls.
Part of rdar://problem/15353101

Swift SVN r22928
2014-10-24 22:23:06 +00:00
Jordan Rose
ca6639cf97 Track types that we perform qualified lookup on from the primary file.
We need to do this mainly to figure out when extensions can affect this file.
This is part of the intra-module dependency tracking work to implement
incremental rebuilds.

Part of rdar://problem/15353101

Swift SVN r22927
2014-10-24 22:23:05 +00:00
Jordan Rose
9afdd1bc2f Print the top-level names "provided" by a file along with its references.
Every name a file declares is something that another file in the same module
might depend on. The driver will need this information too to correctly
decide what files need to be rebuilt. This is part of the intra-module
dependency tracking work to implement incremental rebuilds.

This doesn't handle extensions yet, which are a bit trickier. Need to
figure out how to handle the interaction between extensions and typealiases.

Part of rdar://problem/15353101

Swift SVN r22926
2014-10-24 22:23:04 +00:00
Jordan Rose
fc09bd4585 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
2014-10-24 22:23:03 +00:00