Commit Graph

79 Commits

Author SHA1 Message Date
Sean Callanan
399709ccb8 Optionally separate Tasks` stderr from stdout.
Fixes a serious problem where spurious output from xcrun breaks
swift's discovery of libarclite.

<rdar://problem/28573949>
2017-01-11 11:11:23 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
38be6125e5 [gardening] C++ gardening: Terminate namespaces, fix argument names, ...
Changes:
* Terminate all namespaces with the correct closing comment.
* Make sure argument names in comments match the corresponding parameter name.
* Remove redundant get() calls on smart pointers.
* Prefer using "override" or "final" instead of "virtual". Remove "virtual" where appropriate.
2016-12-17 00:32:42 +01:00
Michael Gottesman
59c6a64f5a [gardening] 0 => nullptr. Fixed with clang-tidy. 2016-12-06 23:14:13 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Brian Gesiak
fc1c81f500 [Frontend] Preserve .swiftdeps files
The Swift compiler uses files with an extension of ".swiftdeps" to store
information about cross-file dependencies. These files are read in at the
start of compilation to compute a dependency graph, and updated as compilation
proceeds. However, because these files are updated on every build, an
issue with dependency analysis is hard to reproduce—the inputs have been
lost.

Address this by renaming swiftdeps files that are about to be
overwritten, to '.swiftdeps~'. This preserves dependency information
from the most recent compilation (but no further back).
2016-11-16 22:51:05 -05:00
Graydon Hoare
8970d44675 Add "-swift-version <n>" that sets LangOpts.EffectiveLanguageVersion.
This flag switches the "effective language version" of the compiler,
at least to any version supported (as of this change: "3" or "3.0").

At the moment nothing uses it except the language version build
configuration statements (#if swift(...)) and various other places
that report, encode, or otherwise check version numbers.

In the future, it's intended as scaffolding for backwards compatibility.

Fixes SR-2582
2016-09-20 15:11:37 -07:00
Brian Gesiak
2b3647efc4 [Driver] Move .swiftdeps strings (NFC)
Define compilation record (.swiftdeps) top-level keys, as well as string
identifiers used in compilation record files (like "!dirty" and "!private"), in
a single location. NFC.
2016-08-30 12:30:14 -04:00
Brian Gesiak
ba8009bfa3 [SR-1788] Add -driver-time-compilation option (#4367)
Add an option to print the time it takes each driver task to complete.

Here's an example of the output:

```
$ swiftc -driver-time-compilation \
         -emit-library -module-name Crispix \
         Crispix/A.swift Crispix/B.swift Crispix/C.swift
===-------------------------------------------------------------------------===
                           Driver Time Compilation
===-------------------------------------------------------------------------===
  Total Execution Time: 0.0000 seconds (0.0875 wall clock)

   ---Wall Time---  --- Name ---
   0.0245 ( 28.0%)  link /path/to/Crispix/A.swift /path/to/Crispix/B.swift /path/to/Crispix/C.swift
   0.0211 ( 24.1%)  compile /path/to/Crispix/A.swift
   0.0209 ( 23.9%)  compile /path/to/Crispix/B.swift
   0.0176 ( 20.1%)  compile /path/to/Crispix/C.swift
   0.0035 (  4.0%)  swift-autolink-extract /path/to/Crispix/A.swift /path/to/Crispix/B.swift /path/to/Crispix/C.swift
   0.0875 (100.0%)  Total
```
2016-08-23 13:35:48 -07:00
Jordan Rose
c9c0df2e55 [Driver] Address Brian G's feedback on 848b3eb. (#4046)
No functionality change.
2016-08-05 17:26:03 -07:00
Jordan Rose
b8cc2673c3 [Driver] Remove debugging code from 848b3eb.
Thanks, Dmitri.
2016-08-03 11:15:49 -07:00
Jordan Rose
848b3eb6a3 [Driver] Make sure to rebuild dependents when a dirty file fails. (#3935)
Otherwise we get into a situation like this:

1. Change made to the interface of file A.swift that also causes an
   error in A.swift.
2. Fixing the error in A.swift does not affect A.swift's interface.
3. File B.swift that depends on A.swift is not rebuilt, since the most
   recent change to A.swift did not change its interface.

To fix this, mark downstream files as needing to be rebuilt even when
a compilation job fails with errors. Additionally, attempt to be extra
conservative when there's a crash.

rdar://problem/25405605
2016-08-02 19:07:29 -07:00
Han Sangjin
cccfbf4d3c [swiftc/msvc] Compiling with MSVC (#1516)
Some modifications for the ms-extension option of the clang.exe in the Visual Studio 2015 development environment

This patch is only for swiftc.exe. I used the library set of Visual Studio 2015 Update 1 and recent version of swift-clang as the compiler. If you are using the real MSVC compiler, more patch might be required.
2016-07-08 19:06:10 -07:00
Jordan Rose
bbc14afd04 [Driver] Write per-job filelists even under -save-temps.
Same as the previous commit; here's a test case that triggers it.

Last bit of https://bugs.swift.org/browse/SR-280.
2016-01-13 18:41:05 -08:00
Jordan Rose
ce34ed593c [Driver] Use filelists for the *output* of a threaded WMO build.
This is only the driver side of the work; the frontend doesn't understand
this new -output-filelist option yet. Next commit.

More https://bugs.swift.org/browse/SR-280.
2016-01-13 18:39:24 -08:00
Jordan Rose
3328a30ea8 [Driver] Write the all-sources file even under -save-temps.
We optimize subprocess invocation to a simple execve() if there's no
cleanup work to do, but that doesn't get us out of doing /setup/ work.
2016-01-13 18:39:24 -08:00
Jordan Rose
6067120f81 [Driver] Emit filelists for Jobs that want them (inputs).
This is the other half of the previous commit: we can use -filelist for
linking on Darwin.

More https://bugs.swift.org/browse/SR-280.
2016-01-13 18:39:24 -08:00
Jordan Rose
f8bb54f6e6 [Driver] Pass around 'const char *' instead of 'const std::string &'.
No functionality change -- lifetime extension is handled by the
ArgumentList already owned by the Compilation.
2016-01-13 18:39:24 -08:00
Jordan Rose
fe00083eb1 [Driver] Actually write out the source file list file.
This is simply a newline-separated list of files, matching the format
from Darwin ld's -filelist option.

Part 2 of https://bugs.swift.org/browse/SR-280.
2016-01-12 19:20:50 -08:00
Jordan Rose
b45a69ef09 [Driver] Allow passing all source files in a filelist.
Generate frontend commands with -filelist in them. This isn't actually
implemented yet, but we can start testing at this point.

Part 1 of https://bugs.swift.org/browse/SR-280.
2016-01-12 19:20:50 -08:00
Jordan Rose
7be3effeed [Driver] Remove an unused accessor.
No one should be accessing the raw input argument list; it's there merely
to keep the info about the derived argument list alive.
2016-01-12 16:17:27 -08:00
Jordan Rose
7552d49c4a [Driver] Eliminate unused fields from Compilation.
No functionality change.
2016-01-12 16:17:27 -08:00
Jordan Rose
5f78d24e85 [Driver] Make the list of input files available when creating Jobs.
Previously jobs had to grovel this information out of the raw argument
list, which dropped the types we had inferred on input files. This
makes things more consistent across the compiler, though arguably we
should be able to designate "primary" and "non-primary" inputs on a
per-action basis rather than resorting to "global" state.

Use this new information to stop passing object file inputs to the
Swift frontend, fixing rdar://problem/23213785.

The list wouldn't have to live on the Compilation, but I'm going to use
it to fix SR-280 / rdar://problem/23878192 as well.
2016-01-12 11:52:31 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Jordan Rose
16a647249d [Driver] Actually set extra environment variables in single-command mode.
Implementing this for the general case either requires duplicating the
existing environment, or modifying TaskQueue to support "extra environment"
settings. Since we don't actually have any use cases for this yet, I'm
leaving it unimplemented for now.

Rest of rdar://problem/23588774
2015-12-04 12:18:47 -08:00
jonnyla
20f7d0947e Improved grammar
removed unnecessary 'so'
2015-12-03 21:58:19 -08:00
Jordan Rose
c403aedbb1 [Driver] Use Swift's shim for std::is_trivially_copyable.
Our libstdc++ doesn't have it yet.

rdar://problem/23387657
2015-11-03 19:38:41 -08:00
Jordan Rose
9b55933e02 Check to see if any source files were modified during the build.
For now, just error out at the end of the build if something was modified,
forcing a rebuild. The incremental logic should get that rebuild right.
We could automatically restart the rebuild, but that could lead to infinite
compilation if the user continues to edit an important file.
2015-11-03 17:53:32 -08:00
Michael Gottesman
c03adef030 Fix "Adjust to InputArgList being a move-only type"
DerivedArgList has a pointer to the InputArgList it came from, so we can't
just std::move it around. Put most of the driver back the way it was, with
small changes to clarify ownership.

Swift SVN r31811
2015-09-09 04:37:29 +00:00
Michael Gottesman
d6cdce1013 Adjust to InputArgList being a move-only type
Swift SVN r31800
2015-09-09 04:37:17 +00:00
Jordan Rose
de2ecbb80e [Driver] Remove the notion of Tools, turn ToolChain into an Action visitor.
The "Tool" abstraction wasn't buying us enough to deserve the added
complexity. Now a ToolChain turns Actions into Jobs, and every helper
tool is searched for relative to Swift first. Much simpler.

Swift SVN r31563
2015-08-28 23:12:33 +00:00
Jordan Rose
298124a272 [Driver] Emit valid YAML. Use spaces instead of tabs.
rdar://problem/21753365

Swift SVN r31238
2015-08-14 01:32:56 +00:00
Jordan Rose
40cd9e479b [Driver] Always quote file paths in the build record.
rdar://problem/21753365

Swift SVN r30054
2015-07-10 01:39:12 +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
83f9ed43c3 [Driver] Don't assert when some files /don't/ get rebuilt but we still merge modules.
...or do anything else that depends on the compile commands that get skipped.

Fix-up to rdar://problem/21129029

Swift SVN r29816
2015-06-30 22:37:22 +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
Jordan Rose
753ca13a83 [Driver] Don't assert that all Compile jobs have only one input.
...whole-module compilations obviously don't. This should fix the
PlaygroundLogger build assertion.

Swift SVN r29716
2015-06-26 00:51:39 +00:00
Jordan Rose
036b083138 [Driver] Eliminate the JobList class.
This was just a wrapper around SmallVector that optionally owned the Job pointers
in it. Now that all Jobs are owned by the Compilation, we don't have to worry
about this any more.

No functionality change.

Swift SVN r29668
2015-06-25 15:45:45 +00:00
Jordan Rose
482cfac8a1 [Driver] Store all Jobs in a flat list in the Compilation object.
The Compilation is now the only owner of the Jobs.

No end-user functionality change.

Swift SVN r29667
2015-06-25 15:45:43 +00:00
Jordan Rose
4af8295600 [Driver] Put all jobs in a single task queue.
Previously, we would process all of a job's dependencies separately before
even scheduling it, and we wouldn't interleave dependencies from different
jobs. This meant (a) more overhead than necessary, and more importantly
(b) -embed-bitcode builds weren't being parallelized.

rdar://problem/21129029

Swift SVN r29665
2015-06-25 15:45:36 +00:00
Jordan Rose
2b7b78d162 [Driver] A .swift file should be rebuilt if its mtime has changed.
...not if it's newer than its output .o file. This handles cases where the
object file is generated too quickly (rdar://problem/19404140) or when you
revert to a previous version of the file, mtime intact (rdar://problem/19720146).

There's a lot of test churn here; the only real new test is the backwards
mtime update in one-way.swift.

Swift SVN r29584
2015-06-24 00:06:58 +00:00
Jordan Rose
af49aa65e0 [Driver] Don't crash when a new file is added to the build.
This was supposed to be part of r28776, but the test got truncated and then
I forgot to commit it.

rdar://problem/21012796

Swift SVN r29039
2015-05-26 23:13:37 +00:00
Jordan Rose
4dacca912d [Driver] Don't full-rebuild when a new file is added.
Continue to full-rebuild when a file is removed, because we don't know what
was depending on it.

Swift SVN r28776
2015-05-19 18:25:51 +00:00
Jordan Rose
31b309906e [Driver] Always write a build record, even if there's only one input.
Don't just exec() a subprocess if there's more work to do when the build
finishes.

Swift SVN r28775
2015-05-19 18:25:49 +00:00
Nadav Rotem
26c62643de Silence a warning that shows up in Release builds.
Swift SVN r27333
2015-04-15 21:38:20 +00:00
Jordan Rose
2c93f561f3 [Driver] Don't reuse a possibly-invalidated iterator.
No test case; this is apparently hitting Enrico but not reproducing in
any obvious way for me. Nevertheless, it /could/ be an issue, so let's be
conservative.

rdar://problem/20402875

Swift SVN r26882
2015-04-02 19:04:28 +00:00
Graham Batty
5e223da24e Verify blocking job count doesn't increase.
This is instead of verifying that it's 0 after running a round.
The previous way would cause it to assert if it the blocking task
was at a higher level of the stack than the current level, and
thus in a different TaskQueue. This way we just verify that
no new tasks are left over.

Swift SVN r26501
2015-03-24 21:55:42 +00:00
Erik Eckstein
cedc6c5671 Driver: simplify handling of temporary files.
Should be NFC.



Swift SVN r26228
2015-03-17 17:06:25 +00:00
Argyrios Kyrtzidis
7fd2ca6fc9 [driver] Introduce 'continue-after-building' functionality in the driver.
The '-update-code' mode is taking advantage of it to go through all the swift files, even though they have errors.

Swift SVN r24902
2015-02-02 21:57:04 +00:00
Jordan Rose
72e5ceca80 [Driver] Handle cases where swiftdeps could not be loaded even after a build.
If a build fails in the middle, we try to determine which other files need
to be rebuilt. However, we may not be able to do that as precisely if the
dependency graph itself is incomplete. In this case, just be conservative
and assume we need to rebuild everything. We may want to revisit this in
the future with a more-aggressive-but-still-safe bound.

This was manifesting itself as an assertion failure, trying to pull
information from the graph that wasn't there.

rdar://problem/19640006

Swift SVN r24823
2015-01-29 21:59:19 +00:00