Commit Graph

684 Commits

Author SHA1 Message Date
David Ungar
c1c9cb8f5d Merge pull request #16762 from davidungar/buildCompilation-refactor-1
NFC: Some small refactoring in `buildCompilation`
2018-06-27 13:57:34 -07:00
David Ungar
62d8501f03 Remove unneeded comment. 2018-06-27 13:05:26 -07:00
David Ungar
3045a25e9c Fix wrong comment. 2018-06-22 13:47:30 -07:00
David Ungar
77ec1e1c36 Clarify lifetime of result of computeWorkingDirectory. 2018-06-22 13:41:53 -07:00
Huon Wilson
db476ba5cd [Driver] Completely remove -emit-public-type-metadata-accessors.
This was retained to help ease migration between versions of the 4.2 compiler
between when the flag was originally introduced and the full fix landed. It's
not longer needed and there's no reason to retain it in the full release.

Fixes rdar://problem/40502379.
2018-06-22 11:31:27 +10:00
swift-ci
9092ac1caf Merge remote-tracking branch 'origin/master' into master-next 2018-06-20 10:10:28 -07:00
Ellis Hoag
c93a5a5776 Add -debug-info-format=[dwarf|codeview] option (#16888) 2018-06-20 09:52:57 -07:00
David Ungar
272c5d87ed Small improvements from Jordan’s review. 2018-06-15 11:09:19 -07:00
David Ungar
9fd23bbeec Minor refactor of buildCompilation
1. Compute things closer to use, and use const, and
2. Factor out some computations into subroutines in order to shorten buildCompilation.
2018-06-15 10:51:05 -07:00
Bob Wilson
5df3d1f100 Merge remote-tracking branch 'origin/master' into master-next 2018-06-14 20:51:48 -07:00
Graydon Hoare
8be2c53b24 [BatchMode] Add -driver-batch-count to allow overriding batch count inferred by -j 2018-06-14 11:51:31 -07:00
Bob Wilson
c3e02955bb [master-next] Adjust for VersionTuple moving from clang to llvm.
LLVM r334399 (and related Clang changes) moved clang::VersionTuple to
llvm::VersionTuple. Update Swift to match.

Patch by Jason Molenda.
rdar://problem/41025046
2018-06-12 16:44:11 -07:00
David Ungar
46339a79d8 Remove “using batch mode” remark. 2018-06-05 11:19:22 -07:00
Mishal Shah
3f8ce7d2f9 Update master to build with Xcode 10 beta 1, OS X 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs. 2018-06-04 23:14:19 -07:00
Robert Widmann
da13d89c24 Move DummyQueue logic into buildTaskQueue 2018-05-29 21:58:27 -07:00
Robert Widmann
d7493dd0fa [NFC] Expose the TaskQueue as a Compilation Parameter
Shuffle the responsibility for creating the TaskQueue out of the
Compilation's internal job state object and into the driver.  Expose
a builder convenience function that handles the argument parsing.
2018-05-29 21:58:27 -07:00
Benjamin Herzog
07d4303b40 Merge pull request #16444 from BenchR267/feature/add-metrics-to-driver-output
[Driver] Added process information to emitted task messages
2018-05-25 16:49:09 -07:00
Benjamin Herzog
ac10fb3462 [Driver] Added process information to emitted messages
When providing the -parseable-output flag to the swift compiler, it will provide json formatted messages about tasks that run.
I added some optional usage information in form of user time, system time and maxrss to the output. This can be used by other tools using the compiler to get some insights about time and memory usage.
Since the output does not longer match processes run (in batch mode), I also added a real_pid field so the client could reason about jobs that belong together if needed.

rdar://39798231
2018-05-25 13:12:57 -07:00
Huon Wilson
60ae475ca0 [IRGen] Make -emit-public-type-metadata-accessors a no-op.
This work-around is no longer needed now that the full fix landed in
https://github.com/apple/swift/pull/16615. The argument is left with a warning
to help with migration between compilers with the work-around and compilers with
the full fix (see also rdar://problem/40502379).

Fixes rdar://problem/40476573.
2018-05-24 09:37:35 +10:00
David Ungar
83c0d77c1f Batch mode driver remark 2018-05-13 12:58:31 -07:00
Jordan Rose
606ee29b74 [Driver] -enable-batch-mode implies -continue-building-after-errors (#16521)
The logic in 46b8ad3 to avoid putting certain diagnostics into
serialized diagnostic files only makes sense if

1. every diagnostic emitted in file A.swift while processing a
   different file B.swift would be emitted if we processed A.swift on
   its own

2. we actually do process A.swift on its own in the same build,
   or have previously done an incremental build and produced the same
   diagnostic

But the latter isn't actually guaranteed: if one batch job exits with
a failure status, the driver will exit as well, assuming there's no
point in continuing. Fortunately, we do have a flag that overrides
this behavior, -continue-building-after-errors.

(As noted in the patch, -continue-building-after-errors isn't *exactly*
what we want. But it's conservatively correct.)
2018-05-10 21:44:12 -07:00
Jordan Rose
a214f0b39b Fix call to llvm::opt::OptionTable::PrintHelp (#16269)
The signature here changed, but the old arguments implicitly converted
to the parameter types for the wrong overload, so we didn't notice.
Add a simple test that would have at least caught this for the driver.
2018-05-02 16:54:10 -07:00
Huon Wilson
d4f49a1252 [IDE] std::function -> llvm::function_ref for some non-escaping params. 2018-05-01 08:29:06 +10:00
David Ungar
2b89d1cf1b Instead of crashing for bad output-file-map path, exit. Also print the path in the diagnostic. 2018-04-24 11:53:52 -07:00
Jordan Rose
e1b70cdb7b Merge pull request #15813 from jrose-apple/decremental
[Driver] Disallow -autolink-force-load with -incremental
2018-04-19 14:20:41 -07:00
Thomas Roughton
5bb6ac2e12 Implement a Windows toolchain. 2018-04-18 15:26:05 +12:00
Jordan Rose
c3d8fc0254 [Driver] Break up validateArgs() into several helper functions
No functionality change.
2018-04-16 20:01:25 -07:00
Argyrios Kyrtzidis
b6a8725ba5 Remove unnecessary newline whitespace 2018-04-12 19:45:51 -07:00
Argyrios Kyrtzidis
8207212f0b [driver/index] Fix an issue where the -index-file invocation was not working when there are 5 or more input files
When the supplementary-outputs file is written for an -index-file invocation it writes out the first input file
given in arguments instead of the input file that is provided by -index-file-path option. This then causes the frontend
index invocation to fail with an error because there is a mismatch in the primary input file and the input file that is written
in the supplementary-outputs file.
2018-04-12 19:37:44 -07:00
Argyrios Kyrtzidis
0682756a72 Merge pull request #15743 from nathawes/rdar38231888-sourcekit-error-when-parsing-the-compiler-arguments
[Driver] Add -driver-filelist-threshold to set the number of inputs beyond which filelists are used
2018-04-12 19:10:40 -07:00
Nathan Hawes
0a4204e99f [Driver] Add -driver-filelist-threshold to set the number of inputs beyond which filelists are used
When generating a compiler invocation in driver::createCompilerInvocation()
we end up using filelists if the number of inputs is > 128 (to work around
command line arg limits). We never actually write them out though, and so
fail when parsing the frontend arguments that reference them.

As this function is called frequently by SourceKit and command line limits
aren't a concern here, this patch makes the 128 threshold value configurable
via a new -driver-filelist-threshold option. This is set to its maximum value
in driver::createCompilerInvocation() to ensure filelists aren't used. This
new option makes the existing -driver-use-filelists (that forces filelists to
be used) redundant as it's now equivalent to -driver-filelist-threshold=0.

Resolves rdar://problem/38231888
2018-04-12 05:24:03 -07:00
Jordan Rose
36150a8696 [Driver] Disallow -autolink-force-load with -incremental
6af333f3 changed the implementation of -autolink-force-load to only
generate one symbol, but the /placement/ of that one symbol depends on
the order of input files, and -incremental supports adding a file
without rebuilding all other files. We don't have any need for these
two to play nice together right now, so just disallow it.
2018-04-06 20:06:24 -07:00
David Ungar
906e1cadc3 Add some "consts" to the Driver. 2018-04-06 18:47:48 -07:00
Graydon Hoare
a9916dfd23 [BatchMode] Address review comments. 2018-04-04 16:29:02 -07:00
Graydon Hoare
0b4e7db476 [BatchMode] Consolidate reasoning about -{enable,disable}-batch-mode flag.
Previous to this change, the initial inspection of the -{enable,disable}-batch-mode
flag was made separate from the subsequent overriding by -wmo; this in turn meant
that the driver might decide it's "in batch mode" in one place (in particular,
when judging whether to ignore the -num-threads flag) and "in wmo mode" elsewhere
(when judging whether to emit one or multiple outputs, which depends on the
-num-threads flag).

Divergence between these two views caused the driver to effectively drop
the -num-threads flag even when overriding batch mode with wmo; since xcode
assumes that passing -wmo -num-threads _will_ cause multiple outputs, this
in turn caused linking to fail since the expected output files were not found.
2018-04-04 15:21:12 -07:00
Rintaro Ishizaki
2cec8dfc99 [Driver] Factor out build-record filename construction
* Retrive filename for read and write at the same time.
* Read LastBuildTime directly from the build record.
2018-04-03 20:39:55 +09:00
Rintaro Ishizaki
18ceef56e3 [Driver] Use separated build record file for '-emit-module' only mode
* In full compilation '-c' with '-emit-module', output duplicated build
  record file for full compilation *and* emit module ('~moduleonly') mode.
* In '-emit-module' only mode, use '~moduleonly' build record.
2018-04-02 21:04:13 +09:00
David Ungar
43b89133af Warn if explicit batch mode is overridden. 2018-03-28 17:31:34 -07:00
David Ungar
4fa3001bd1 Harden compiler against -num-threads and -enable-batch-mode. 2018-03-26 17:04:31 -07:00
Sho Ikeda
1508b6f131 [gardening][Driver] Replace typedef with using 2018-03-23 19:14:50 +09:00
David Ungar
807dd5864e Renamed swift::types to swift::file_types. 2018-03-22 08:40:06 -07:00
David Ungar
90773d298c Write out filemaps for supplementary outputs.
Add -driver-force-one-batch-repartition and enhance  batch_mode-overlong_argv test.
2018-03-20 09:42:13 -07:00
Sho Ikeda
cea6c03eb2 [gardening] Use !empty() over size() > 0 2018-03-08 09:21:09 +09:00
David Ungar
90d2740817 Merge pull request #14961 from davidungar/PR-18-10-HHH
[Batch mode] Restore -### functionality for batch-mode by extending OutputLevel.
2018-03-06 09:54:03 -08:00
Jordan Rose
be4c2b97fc Merge pull request #14950 from Nonchalant/sr_7040_redundant_D
[SR-7040] Redundant prefix of compilation flag specific error
2018-03-06 08:56:27 -08:00
David Ungar
17a81f6981 Restore -### functionality for batch-mode by extending OutputLevel. 2018-03-05 11:07:20 -08:00
Nonchalant
3fca891628 active conditional compilations: show friendly error message 2018-03-03 13:02:16 +09:00
George Karpenkov
a65da887f2 Determine whether a given sanitizer is available based on the presenc… (#14919)
Determine whether a given sanitizer is available based on the presence of the library.

rdar://37192887
2018-03-02 16:57:45 -08:00
Graydon Hoare
45c78c4f7d [BatchMode] Add a pile of asserts to CommandOutput. 2018-02-28 14:07:25 -08:00
Ben Langmuir
d991452367 Merge pull request #14746 from benlangmuir/working-directory
[driver] Add -working-directory option
2018-02-21 14:56:56 -08:00