Commit Graph

24 Commits

Author SHA1 Message Date
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Jordan Rose
51aee8b3be [Driver] Properly handle new cascading dependencies.
The existing code was only recording a change in the /last/ dependency as needing
to rebuild the file. This could have caused things not to get rebuilt when they
should have.

In practice, a number of things have to coincide for this to cause problems:
- A dependency (let's say a type) has to be considered "modified" in this build.
- Some other file has to get rebuilt that didn't previously depend on the type,
  or only depended on it in a non-cascading way (e.g. it's only used in function
  bodies).
- The file had to not be rebuilt because of any cascading dependencies (or
  because it itself changed).
- The file has to now depend on the type in a cascading way, so that downstream
  files need to be rebuilt when they didn't before.

Noticed by inspection while fixing the previous issue.
2015-12-14 13:24:31 -08:00
Jordan Rose
4698886b54 [Driver] Fix an uninitialized variable.
This only shows up when there's a present-but-empty sequence node in
a swiftdeps file. The compiler never generates this, but it's in some of
the tests. I'm not sure why ASan didn't catch this.

This should fix the failures some people have been seeing with
test/Driver/Dependencies/private-after.swift, rdar://problem/23382722.
2015-12-14 13:24:31 -08:00
Jordan Rose
1473828eac [Driver] Don't crash on a bad swiftdeps file.
Normally we don't get here because the build record will be out of date,
but if we don't actually rebuild all the files we'll crash on the /next/
build.

Swift SVN r30889
2015-07-31 23:21:34 +00:00
Jordan Rose
963c442b44 [Driver] Add support for interface-hash.
Dependents of modified files are no longer rebuilt by default, only if it turns
out that file's interface has changed. There is a flag
-driver-always-rebuild-dependents to override this, but we expect it to only be
used for testing. (Most of the existing dependency tests pick up this option;
the two new tests have "interface-hash" in the name.)

This is the second half of ChrisW's work on interface hashing.

rdar://problem/15352929

Swift SVN r30478
2015-07-22 00:14:01 +00:00
Jordan Rose
2ad0ffd6e4 Dependencies: teach the Driver about the new member-based dependencies.
If file A extends a common type (say, Dictionary), but only adds new members,
other files using Dictionary don't need to be recompiled if they definitively
don't use those members. That should be working now.

Swift SVN r30286
2015-07-16 23:36:33 +00:00
Jordan Rose
c79952389c Dependencies: rename entries in the .swiftdeps file to something sensible.
- (depends|provides)-top-level for top-level names.
- (depends|provides)-nominal for access into nominal types.
- (depends|provides)-dynamic-lookup for @objc members available on AnyObject.
- depends-external for cross-module file-based dependencies.

No functionality change.

Swift SVN r30283
2015-07-16 23:36:26 +00:00
Jordan Rose
80b734d014 [Driver] -driver-show-incremental: avoid showing duplicates.
Swift SVN r29819
2015-06-30 23:12:43 +00:00
Jordan Rose
6275c78a69 [Driver] -driver-show-incremental: fix printing of protocols.
Actually use the existential-like name we constructed.

Swift SVN r29818
2015-06-30 23:12:41 +00:00
Jordan Rose
45189f9feb [Driver] Add a basic tracing mode to determine why files are getting rebuilt.
Enabled with -driver-show-incremental. For debugging purposes only.

Swift SVN r29804
2015-06-30 19:31:07 +00:00
Arnold Schwaighofer
680b1ded21 Add a now missing include file
Yay for upstream header cleanup

Swift SVN r26443
2015-03-23 20:32:36 +00:00
Jordan Rose
5e889c0c8a [Driver] Load cross-module dependencies into the dependency graph.
We don't actually check them yet, but this fits them into the same dependency
structure as intra-module dependencies.

Part of rdar://problem/19270920

Swift SVN r24335
2015-01-10 00:38:10 +00:00
Jordan Rose
2c7a195832 [Driver] Honor dynamic lookup dependencies.
Swift SVN r24053
2014-12-20 01:59:11 +00:00
Jordan Rose
43bcbb8f9e [Driver] Handle outstanding jobs by reading the build record.
r23968 wrote out a record of which source files were included in a build,
and whether they were succesfully compiled or not...and if not, whether
they were out of date because of a cascading or non-cascading dependency.
This commit uses that information to decide what files might need to be
rebuilt even if a particular input doesn't change and doesn't appear to
have any changed dependencies. The two interesting cases are:

- A file was going to be built last time, but the build was halted
  because of an error. Build it this time.
- One of the files was removed and thus we've lost a source of dependency
  information; rebuild everything!

rdar://problem/19270980

Swift SVN r24018
2014-12-18 21:24:18 +00:00
Jordan Rose
9ddd23c0ff Invert DeclContext::is[Non]CascadingContextForLookup.
...and a few other things.

Attempting to remove a few negations to minimize confusion.
No intended functionality change.

Swift SVN r23970
2014-12-17 02:42:48 +00:00
Jordan Rose
99075516ce Use "cascading/non-" terms for dependencies instead of "private/non-".
"private" is a very overloaded term already. "Cascading" instead of
"non-private" is a bit more clear about what will happen with this sort
of lookup.

No functionality change. There are some double negatives I plan to clean
up in the next commit, but this one was supposed to be very mechanical.

Swift SVN r23969
2014-12-17 02:42:45 +00:00
Jordan Rose
24118c95db [Driver] Handle dependencies we learn about after a job is run.
Specifically, we care about the case where a job is run because of a private
dependency, and then a non-private dependency turns out to be dirty. In
this case, we still need to make sure to build all downstream files.

With this the driver support for private dependencies should be complete
and correct.

Swift SVN r23853
2014-12-11 01:12:02 +00:00
Jordan Rose
20cd316500 [Driver] Add basic support for private dependencies.
- Add flags to dependency entries in DependencyGraph.
- Don't traverse past private dependencies in markTransitive.
- Only mark dependent jobs after a build if the build was triggered
  (a) explicitly (because the file is out of date), or
  (b) because of a non-private dependency.

This still isn't fully correct because of new non-private dependencies
discovered /after/ building an individual file, but it's on the way there.
Solving that problem will require tracking which dependencies have already
been marked dirty (next commit).

Swift SVN r23852
2014-12-11 01:11:58 +00:00
Jordan Rose
e48245a715 [Driver] Refactor DependencyGraph in preparation for private dependencies.
- Give loadWithPath an enum result that includes "NeedsRebuilding".
  This will be returned when a new dependency is discovered that
  retroactively affects the graph.
- Don't clear the "provides" set for a node when it gets reloaded;
  just append to it. This lets us avoid calling markTransitive twice.
- Use proper types for "depends" and "provides" entries instead of std::pair.
- Use swift::OptionSet instead of a manual bitmask.
- Use separate "depends" and "provides" callbacks when parsing dependency
  files.

No expected functionality change.

Swift SVN r23851
2014-12-11 01:11:57 +00:00
Ben Langmuir
e9e1666ab0 Update for upstream LLVM changes
* removal of StringMap's GetOrCreateValue
* SmallSet::insert now returns a pair like std::set

Swift SVN r23435
2014-11-19 16:49:30 +00:00
Jordan Rose
0867224a0f [Driver] Handle null lists in the YAML dependencies file.
The right way to do this would be to emit "provides: []", but that's more
work for a format that's ultimately going away. Just accept the null
representation "provides:" for now.

Swift SVN r23394
2014-11-18 01:38:22 +00:00
Jordan Rose
5ad871ecd6 Adopt llvm::function_ref for callbacks that aren't persisted.
...removing a few other constructs that were doing the same thing
(mostly from me).

No functionality change.

Swift SVN r23294
2014-11-13 00:19:03 +00:00
Jordan Rose
a4a6b42604 [Driver] Only run compile jobs if needed.
This teaches the driver's Compilation to not run jobs where the base input
is older than the main output (r23221) when we're tracking dependencies.
After a compile command finishes, anything that depended on the file that
just got compiled will get scheduled.

This has the nice side effect of trying to rebuild changed files first.

The tests here aren't really testing the dependency graph yet, because the
files don't include any dependencies. I'll be adding several more test
scenarios in the next few commits.

Part of rdar://problem/15353101

Swift SVN r23273
2014-11-12 18:06:10 +00:00
Jordan Rose
8b5d763e39 [Driver] Add a new DependencyGraph class.
...and some basic unit tests for it.

The purpose of this class is to track dependencies between opaque nodes.
The dependency edges are (kind, string) pairs, where the "kind"
distinguishes different kinds of dependencies (currently "top-level names"
and "types that we do lookup on"). The step is to make use of it in
running compile commands.

The YAML-based file format is only for bring-up and testing purposes.
I intend to switch it to a bitcode-based format in the long run.

Part of rdar://problem/15353101

Swift SVN r23223
2014-11-11 00:43:29 +00:00