695 Commits

Author SHA1 Message Date
Jordan Rose
b5b787b909 [Driver] Reordering inputs should not force a rebuild.
For that matter, adding and removing inputs should not force a rebuild
either. Those need to be taken care of by more specific cases.

Swift SVN r28751
2015-05-19 05:08:11 +00:00
Erik Eckstein
50423166aa Driver: fix a few things to get -embed-bitcode working with multi-threaded compilation.
Swift SVN r28517
2015-05-13 17:52:57 +00:00
Manman Ren
249239e14d [Bitcode Driver] make sure -embed-bitcode works with -force-single-frontend-invocation.
With both force-single-frontend-invocation and embed-bitcode, we create
CompileJobAction and BackendJobAction, similar to how we handle embed-bitcode
with StandarCompile.

This commit should only affect Bitcode mode.

rdar://20796819


Swift SVN r28129
2015-05-04 19:40:54 +00:00
Jordan Rose
b33994fabd [Driver] Bump required versions of the SDKs.
rdar://problem/20408977

Swift SVN r28043
2015-05-01 18:16:13 +00:00
Argyrios Kyrtzidis
8b250d6d35 [driver] Remove the 'swift-fixit' symlink and introduce '-emit-fixits-path' frontend option that
writes compiler fixits as source edits.

Driver option '-fixit-code' adds '-emit-fixits-path' for all the frontend invocations.

Swift SVN r27208
2015-04-10 17:33:29 +00:00
Argyrios Kyrtzidis
6ee8f9b9b7 [driver] Add option "-fixit-code" which delegates to 'swift-fixit'.
Swift SVN r27142
2015-04-08 22:20:34 +00:00
Argyrios Kyrtzidis
623b9827b4 [driver] Separate "delegate to the migrator with swift-update" and "get compiler fixits with swift-fixit" functionalities.
Swift SVN r27139
2015-04-08 22:02:23 +00:00
David Farler
544ef4002d Merge tvOS and watchOS Support
- Add frontend and standard library build support for tvOS.
- Add frontend support for watchOS.

watchOS standard library builds are still disabled during SDK bring-up.

To build for TVOS, specify --tvos to build-script.
To build for watchOS, specify --watchos to build-script (not yet supported).

This patch does not include turning on full tests for TVOS or watchOS, and
will be included in a follow-up patch.

Swift SVN r26278
2015-03-18 21:35:07 +00:00
Erik Eckstein
f3ff3db85f Driver: small corrections according to Jordan's feedback
Swift SVN r26267
2015-03-18 17:43:47 +00:00
Erik Eckstein
5537cf84ca Driver: Support -num-threads <n> option.
Together with -wmo it enables multi-threaded compilation.
I didn't want to reuse the -j option for this, because -num-threads (even if n == 1) does change the generated code.
For details see commit message of r25930.



Swift SVN r26258
2015-03-18 10:05:11 +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
Luqman Aden
0c6464aec7 [driver] Add -emit-sibgen option.
Swift SVN r25936
2015-03-10 18:31:08 +00:00
Luqman Aden
34b74cfa1c [driver] Add -emit-sib primary action.
Swift SVN r25783
2015-03-05 19:15:07 +00:00
Dmitri Hrybenko
cc05e7640b Disable Linux support in Apple B&I builds
Swift SVN r25633
2015-02-28 02:42:43 +00:00
Graham Batty
c48b5e1a0a Use LLVM's config to determine correct dylib ext.
Later this should be derived from the target so cross-compilation
does the right thing, but for now this at least makes it so that
it does the right thing for the non-cross-compile case.

Swift SVN r25564
2015-02-26 21:43:16 +00:00
Manman Ren
391e731796 [Driver] add -embed-bitcode for bitcode store project.
With -embed-bitcode, we will invoke swift twice, once to generate the bitcode
file, the second time to perform code generation on the bitcode file.

For now, -embed-bitcode causes -incremental builds to not be incremental,
because of potential issues of mixing the two.

rdar://19048891


Swift SVN r25559
2015-02-26 19:53:12 +00:00
Jordan Rose
02f0ee10c4 [Driver] Fix a use-after-free caught by the ASan bot.
Swift SVN r25533
2015-02-25 19:42:40 +00:00
Graham Batty
078a558b26 Extract autolink information as a compile step.
Swift SVN r25510
2015-02-24 20:33:05 +00:00
Jordan Rose
cadd851e1b [Driver] Warn when using -incremental without a proper output file map.
Just so people don't try to use it on the command line and then get
surprised.

Swift SVN r25508
2015-02-24 20:02:26 +00:00
Jordan Rose
6430d30a51 [Driver] For now, just ignore -incremental under -whole-module-optimization.
These aren't inherently incompatible, but today it would do nothing useful,
and using both flags together causes problems (see previous commit).

rdar://problem/19669432

Swift SVN r25389
2015-02-19 02:28:34 +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
9a9a6969b7 [Driver] Error if we don't support the target we're given.
Also, normalize the target triple up front, so that we're never dealing
with non-normalized triples in the driver unless explicitly asking for
the original user option.

rdar://problem/18065292

Swift SVN r24563
2015-01-20 20:42:03 +00:00
Jordan Rose
6e0df7d65e [Driver] Rebuild everything when command-line arguments change.
If certain command-line arguments change, the results of the last
compilation aren't reusable, i.e. we can't do an incremental build.
Do a full rebuild when we detect that this happens.

(Which command-line options? Conservatively assume all of them, /except/
those with the new DoesNotAffectIncrementalBuild flag in Options.td.)

Swift SVN r24385
2015-01-13 01:11:38 +00:00
Jordan Rose
1b7cd80d1d [Driver] Track the latest a particular job could have been run.
This is mostly just a matter of not throwing away mtimes we were already
looking up. We can compare these values to the mtimes of cross-module
dependencies to find out what's been updated.

Part of rdar://problem/19270920

Swift SVN r24336
2015-01-10 00:38:11 +00:00
Argyrios Kyrtzidis
e021f5077d [swift-update] Treat 'swift-update' as a symlink to the driver, instead of a separate executable.
This avoids having another copy of the frontend in the toolchain.

Swift SVN r24320
2015-01-09 18:55:16 +00:00
Argyrios Kyrtzidis
7a7ad97815 [driver] Change 'UseUpdateCodeTool' boolean into a OutputInfo::Mode::UpdateCode compiler mode.
Swift SVN r24290
2015-01-09 01:08:08 +00:00
Argyrios Kyrtzidis
eb89a0c6c0 [driver] Introduce '--update-code' which enables the driver to spawn invocations
of 'bin/swift-update' with the related frontend options.

'swift-update' will be the tool for producing diffs to update swift code to the
latest version.

Swift SVN r24287
2015-01-08 23:46:13 +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
94e7a284bd [Driver] Write out a record of which files were compiled in a build.
This is important because we might get part-way through the full
compilation, overwriting swiftdeps files as we go, and then encounter an
error. We don't want to lose information about any decls that have been
removed since the previous compile, so we propagate forward the information
we already have by saving it to a "build record" file.

More simply, this is necessary to track when a file is removed from a target.

The next commit will handle reading in this file at the start of a build.

Swift SVN r23968
2014-12-17 00:26:28 +00:00
Jordan Rose
c5547f7068 [Driver] Use return value instead of out parameter for buildOutputFileMap.
No functionality change, just a cleanup.

Swift SVN r23966
2014-12-17 00:26:25 +00:00
Jordan Rose
c385a9d43a [Driver] Make the "incremental" flag an explicit part of Compilation.
No functionality change. Laying groundwork for the next commit.

Swift SVN r23965
2014-12-17 00:26:23 +00:00
Chris Willmore
c6ac72e47a Add whole-module optimization option to Swift compiler
Add -whole-module-optimization option as synonym of
-force-single-frontend-invocation (for now). Add support for
-output-file-map when using -whole-module-optimization with multiple
input files -- the key for the single output file's map is the empty string.

<rdar://problem/18603795>

Swift SVN r23625
2014-12-03 00:20:09 +00:00
Adrian Prantl
30976b2eb3 No need to emit a Swift module in -gline-tables-only mode.
Thanks Jordan for pointing this out!

Swift SVN r23616
2014-12-02 18:07:37 +00:00
Adrian Prantl
41a30f5988 Support line table only DWARF for Swift. <rdar://problem/19106981>
The new option is called -gline-tables-only to mirror clang.

Swift SVN r23615
2014-12-02 17:44:23 +00:00
Graham Batty
e2258fa323 Only run dsymutil on darwin.
Swift SVN r23325
2014-11-14 20:14:11 +00:00
Jordan Rose
4870fa905f [Driver] Use -incremental as the top-level option for dependency tracking.
This was being staged as -emit-reference-dependencies, but it's affecting
a lot more than that. Eventually for command line builds this should also
preserve intermediate build outputs (like .o and .swiftmodule) for use in
later builds, rather than putting them in $TMPDIR and deleting them after.

This option is still hidden.

Swift SVN r23295
2014-11-13 00:19:04 +00:00
Jordan Rose
6ca70b3c49 [Driver] Add debug option -driver-use-frontend-path.
This will be used to test dependency analysis by substituting a different
executable to use as the frontend.

For debugging purposes only.

Swift SVN r23272
2014-11-12 18:06:08 +00:00
Jordan Rose
3a52f2ad5c [Driver] Provide a single API to iterate over all valid file types.
Previously we had three separate instances of iterating from TY_INVALID+1
to TY_LAST, completely breaking type safety. Now we have a nice little
wrapper that takes a closure, which should inline down to the same thing
anyway.

Also, eliminate TY_LAST and just use TY_INVALID as our sentinel.

Swift SVN r23222
2014-11-11 00:43:28 +00:00
Jordan Rose
0364724ec3 [Driver] Add an mtime test for single-file compilation jobs.
The Swift compiler is always fed the entire list of files in a module.
If it's told to track dependencies, though, it should look to see if it
actually needs to recompile all of its inputs. The first step in this is
to see which files are actually dirty, which it does by comparing the mtime
of each source file with the mtime of its output object file. If a source
file is not dirty, it only needs to be rebuilt if it depends on something
in a dirty file.

Nothing actually uses this information yet, but we can print it with
-driver-print-bindings!

Swift SVN r23221
2014-11-11 00:43:27 +00:00
Jordan Rose
1fdf0e48b4 [Driver] Add -emit-reference-dependencies to the driver.
This just adds another possible output kind and forwards it to the frontend.
Note that in builds without an output map, this will just dump the dependencies
next to the output file, which is a temp file whose name is chosen randomly.
That's not so useful, but we can fix it later.

Part of rdar://problem/15353101

Swift SVN r23220
2014-11-11 00:43:22 +00:00
Jordan Rose
c4fd29eb0b [Driver] Eliminate the common base class of Command and JobList.
...and rename Command to Job (previously the name of the base class).

We never generated job lists directly contained in other job lists, so
let's not even worry about this case. We may some day need to break Job
out into separate subclasses (Clang has Command and FallbackCommand in
addition to JobList), but we should be able to keep the list separate.

No intended functionality change.

Swift SVN r23144
2014-11-07 00:10:18 +00:00
Chris Willmore
1b6624a5cd llvm::sys::FindProgramByName() -> llvm::sys::findProgramByName()
llvm::sys::FindProgramByName() was removed in llvm r221258. Use
llvm::sys::findProgramByName() instead.

Swift SVN r23103
2014-11-04 19:51:08 +00:00
Jordan Rose
fe68e7512f Add a -gnone option that can negate a previous -g option.
The name -gnone was chosen by analogy with -O and -Onone. Like -O/-Onone,
the last option on the command line wins.

The immediate use case for this is because we want to be able to run the
tests with -g injected into every command line, but some tests will fail
when debug info is included. Those particular tests can be explicitly marked
-gnone.

rdar://problem/18636307

Swift SVN r22777
2014-10-15 22:12:07 +00:00
Jordan Rose
042569a3be Optional: Replace uses of Nothing with None.
llvm::Optional (like Swift.Optional!) uses None as its placeholder value,
not Nothing.

Swift SVN r22476
2014-10-02 18:51:42 +00:00
Graham Batty
a1e0b0fbf7 Driver: More stubbing for Linux support
Swift SVN r22362
2014-09-29 21:14:32 +00:00
Jordan Rose
48bcad35be Address review comments for r21845 and r21846, including updates to ABI.rst.
Thanks, Dmitri and Joe.

Swift SVN r21849
2014-09-10 20:35:30 +00:00
Jordan Rose
86b24b7d5f [Driver] Ban files with the same basename in the same module.
We use the basename to generate the private-discriminator. Why just the
basename? Because we want projects checked out in different locations to
still have a chance of generating identical binaries, and (at least for now)
private symbols still have external linkage.

Part of rdar://problem/17632175

Swift SVN r21845
2014-09-10 19:10:44 +00:00
Jordan Rose
2d727bb7a3 [Driver] Reject SDKs older than OS X 10.10 or iOS 8.
Actually, reject SDK directories whose names match
  "*OSX<version>(.Internal)?.sdk" on OS X with a version older than 10.10
  "*OS7*" on iOS
  "*Simulator7*" on iOS

We only really care about 10.9 anyway, but just in case people install the
one-previous version of iOS...

<rdar://problem/17951615>

Swift SVN r21100
2014-08-08 00:22:35 +00:00
Connor Wakamo
174323481c [driver] Added support for disabling the check that input files exist.
This is only exposed as API on Driver; this check cannot be disabled with a
command line option at this time.

Swift SVN r20930
2014-08-01 23:59:09 +00:00
Connor Wakamo
3722438826 [driver] Fix an assertion failure when running "swiftc -v -force-single-frontend-invocation".
Previously, the driver would unconditionally create a CompileJobAction if it was
in SingleCompile or Immediate mode. If there were no inputs, though, the driver
would end up asserting later because it could not create a Command for a
CompileJobAction with no inputs.

To match the behavior of the StandardCompile mode, avoid creating a
CompileJobAction if there are no inputs. (This change only affects -v, since it
disables the 'no input files' error which otherwise prevents this condition from
being hit.)

Additionally, added a test to check swiftc's behavior when no inputs are
provided.

Swift SVN r20900
2014-08-01 17:55:08 +00:00