695 Commits

Author SHA1 Message Date
Artem Chikin
c3b0232c2c Add compiler option to *disable* warnings-as-errors
`-no-warnings-as-errors`

This functionality is required for build systems to be able to overload/disable a given Swift project's preference of treating warnings as errors.

Resolves rdar://problem/35699776
2020-04-17 12:10:26 -07:00
Michael Forster
fae87c96d7 Move interleave(...) to the llvm namespace
This simplifies fixing the master-next build. Upstream LLVM already
has a copy of this function, so on master-next we only need to delete
the Swift copy, reducing the potential for merge conflicts.
2020-04-17 11:20:50 +02:00
Doug Gregor
8339f32184 [Frontend] Infer simulator environment in the frontend, too.
Some code paths that see target triples go through the frontend
without seeing the driver. Therefore, perform the same "simulator"
inference for x86 iOS/tvOS/watchOS triples also in the frontend,
to ensure that we remain compatible. Also make sure that
-print-target-info performs the appropriate adjustment.
2020-04-16 21:42:43 -07:00
Doug Gregor
643491e37c [Driver] Infer simulator-ness for iOS/tvOS/watchOS.
Localize the hack to infer simulator-ness of the target in the driver
itself, when it first processes the target. Emit a warning about the
missing "-simulator" and correct the triple immediately.

This gives a longer grace period for tools that might still not pass
through the simulator environment, while narrowing the hack.
2020-04-16 13:24:11 -07:00
Doug Gregor
970ff6b818 [Driver] Read SDK version information to pass to the Darwin linker.
Recent-ish SDKs for Darwin platforms include an SDKSettings.json
file with version information and Catalyst SDK version mappings. Read
these (when available) and use them to pass the appropriate SDK
version down to the Darwin linker via `-platform_version`.

Finishes rdar://problem/55972144.
2020-04-02 21:07:26 -07:00
Alex Langford
8953af519f [Driver] Don't pass ELF shared objects to swift-autolink-extract
Prior to performing linking on ELF platforms (except the PS4) we extract
autolink information from the object files that will be used during linking.
The current implementation passes all the linker inputs that are marked as an
TY_Object to swift-autolink-extract. There are a two cases where this is
not necessary or problematic.

In the first case, we are looking at an ELF shared object. Although
harmless, this is wasted work. Specifically, the `.swift1_autolink_entries`
entry in the object files are marked as `SHF_EXCLUDE`, meaning they will not be
merged into the final product during linking.

In the second case, we are linking against a linker script that looks like an
ELF shared object (ends with `.so`). In the previous case, the autolink-extract
step will succeed even if it does unnecessary work. In this case, the
autolink-extract step will fail because it cannot recognize the linker script as
an object file. You will observe an error something like this:
```
<unknown>:0: error: error opening input file '/path/to/libLinkerScript.so'
(The file was not recognized as a valid object file
```
Although your linker will know what to do with it, autolink-extract will halt
before you get to that point.
2020-03-17 21:54:00 -07:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Robert Widmann
ef149d5c86 Merge pull request #30135 from CodaFi/verily-i-depend-on-thee
[Incremental] Introducing: DependencyVerifier
2020-03-03 22:01:38 -08:00
Robert Widmann
f85ec3825f Address review feedback 2020-03-03 16:46:04 -08:00
Visoiu Mistrih Francis
aaab1869af Merge pull request #29650 from francisvm/sil-remark-streamer
[Remarks] Add a specialized RemarkStreamer for SIL remarks
2020-03-03 09:30:17 -08:00
Francis Visoiu Mistrih
e724ebab6b [Remarks] Add a specialized RemarkStreamer for SIL remarks
This allows the usage of the whole remark infrastructure developed in
LLVM, which includes a new binary format, metadata in object files, etc.

This gets rid of the YAMLTraits-based remark serialization and does the
plumbing for hooking to LLVM's main remark streamer.

For more about the idea behind LLVM's main remark streamer, see the
docs/Remarks.rst changes in https://reviews.llvm.org/D73676.

The flags are now:

* -save-optimization-record: enable remarks, defaults to YAML
* -save-optimization-record=<format>: enable remarks, use <format> for
serialization
* -save-optimization-record-passes <regex>: only serialize passes that
match <regex>.

The YAMLTraits in swift had a different `flow` setting for the debug
location, resulting in some test changes.
2020-03-02 18:33:20 -08:00
Robert Widmann
d3edb5b15a [Incremental] Plumb -verify-incremental-dependencies Through The Frontend and Driver
When enabled at the driver level, the frontends will inherit the flag. For each frontend that recieves this option, all primaries will have their reference dependencies validated.
2020-03-02 16:45:37 -08:00
3405691582
0d3b92dfb1 Swift Basic/Driver recognizes OpenBSD.
Add the platform conditional and set up other basics for the toolchain.

The ConditionalCompilation tests are updated to match, since otherwise
they seem to trip when building on non-OpenBSD platforms. The
Driver/linker test is updated to ensure lld is passed on this platform.
Note that OpenBSD calls "x86_64" as "amd64", so we use that name for the
architecture instead of trying to alias one to the other, as this makes
things simpler.
2020-02-27 17:14:22 -05:00
Alexis Laferrière
901392896d [Frontend] Output the private module interface with the SPI info 2020-02-19 14:17:14 -08:00
Brent Royal-Gordon
6cce3d374e Add swiftcrossimport and swiftoverlays file_types 2020-02-18 11:06:12 -08:00
swift-ci
0dc9c02d07 Merge pull request #29772 from DougGregor/disable-one-dependency-file 2020-02-11 17:20:54 -08:00
Robert Widmann
054d7b9913 Merge pull request #29713 from CodaFi/unused-unwanted-unloved
[Gardening] Silence Some Warning Spew
2020-02-11 15:46:16 -08:00
Doug Gregor
d000065ab1 Revert "Change to defaulting on"
This reverts commit b1f6a8941c. This
change is causing some instability with incremental builds, so we're
backing it out. Fixes rdar://problem/59016969.
2020-02-11 15:34:48 -08:00
Robert Widmann
d2360d2e8c [Gardening] dyn_cast -> isa 2020-02-07 16:09:31 -08:00
swift-ci
9d310503ce Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-03 19:03:03 -08:00
Brent Royal-Gordon
b4771c20a0 Merge pull request #29591 from brentdax/stay-on-target
Add target variant to -print-target-info
2020-02-03 19:00:50 -08:00
swift-ci
782b4e1bfa Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-03 15:42:56 -08:00
Xi Ge
273500ec76 Driver: add an option to avoid emitting .swiftsourceinfo files 2020-02-03 13:05:23 -08:00
Brent Royal-Gordon
161061f8a3 Pass target-variant through the driver for -print-target-info 2020-02-01 15:33:38 -08:00
swift-ci
81a6a266aa Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 18:23:23 -08:00
David Ungar
d61f6f2f66 Changes to support per-type-body fingerprints. 2020-01-27 15:14:46 -08:00
swift-ci
f324eb6a1e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-23 15:04:45 -08:00
David Ungar
2f79ff7875 Merge pull request #29390 from davidungar/centralizeDefault
[Incremental] Use the initial value of EnableFineGrainedDependencies as the default.
2020-01-23 14:58:50 -08:00
David Ungar
98b86c63d1 Use the initial value of EnableFineGrainedDependencies as the default. 2020-01-23 12:12:17 -08:00
swift-ci
810bf82c09 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-23 00:37:05 -08:00
Keith Smiley
8c8c9784d6 Add -no-whole-module-optimization (#29362)
This adds an argument to allow negating `-whole-module-optimization`.
This is useful for cases where it's easier to add an extra flag to your
swiftc invocation rather than removing the original one.
2020-01-23 00:13:00 -08:00
Erik Eckstein
bbfaccda4b Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-22 08:25:23 +01:00
Devin Coughlin
655d89b146 [Driver/Frontend] Add Driver support for macCatalyst and library search paths
Add support in the driver and frontend for macCatalyst target
targets and library search paths.

The compiler now adds two library search paths for overlays when compiling
for macCatalyst: one for macCatalyst libraries and one for zippered macOS
libraries. The macCatalyst path must take priority over the normal macOS path
so that in the case of 'unzippered twins' the macCatalyst library is
found instead of the macOS library.

To support 'zippered' builds, also add support for a new -target-variant
flag. For zippered libraries, the driver invocation takes both a -target and a
-target-variant flag passes them along to the frontend. We support builds both
when the target is a macOS triple and the target variant is macCatalyst and
also the 'reverse zippered' configuration where the target is macCatalyst and the
target-variant is macOS.
2020-01-21 18:28:17 -08:00
swift-ci
e280ebe9b7 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-12 21:44:31 -08:00
David Ungar
cc89dad526 Fine-grained and driver fixes.
Restructure fine-grained-dependencies to enable unit testing

Get frontend to emit correct swiftdeps file (fine-grained when needed) and only emit dot file for -emit-fine-grained-dependency-sourcefile-dot-files

Use deterministic order for more information outputs.

Set EnableFineGrainedDependencies consistently in frontend.

Tolerate errors that result in null getExtendedNominal()

Fix memory issue by removing node everywhere.

Break up print routine

Be more verbose so it will compile on Linux.

Sort batchable jobs, too.
2020-01-11 21:57:14 -08:00
swift-ci
e0c29988fe Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-10 15:04:04 -08:00
Ashley Garland
7a3a0a9e23 Symbol graph support
Adds a tool `swift-symbolgraph-extract` that reads an existing Swift
module and prints a platform- and language-agnostic JSON description of
the module, primarly for documentation.

Adds a small sub-library `SymbolGraphGen` which houses the core
implementation for collecting relevant information about declarations.
The main entry point is integrated directly into the driver as a mode:
the tool is meant to be run outside of the normal edit-compile-run/test
workflow to avoid impacting build times.

Along with common options for other tools, unique options include
`pretty-print` for debugging, and a `minimum-access-level` options for
including internal documentation.

A symbol graph is a directed graph where the nodes are symbols in a
module and the edges are relationships between them. For example, a
`struct S` may have a member `var x`. The graph would have two nodes for
`S` and `x`, and one "member-of" relationship edge. Other relationship
kinds include "inherits-from" or "conforms to". The data format for a
symbol graph is still under development and may change without notice
until a specificiation and versioning scheme is published.

Various aspects about a symbol are recorded in the nodes, such as
availability, documentation comments, or data needed for printing the
shapes of declarations without having to understand specifics about the
langauge.

Implicit and public-underscored stdlib declarations are not included by
default.

rdar://problem/55346798
2020-01-10 09:53:37 -08:00
swift_jenkins
21401ad11f Merge remote-tracking branch 'origin/master' into master-next 2019-12-19 11:59:47 -08:00
Vinicius Vendramini
aebfb53966 Ast dump ignore wmo (#20596)
* Ignore -wmo when passing -dump-ast

* Cleanup on driver diagnostics

* Remove the FIXME.

* Add support for ignoring `-index-file`

* Revert unrelated formatting changes

* Revert back to only ignoring `-wmo`

Ignoring both `-wmo` and `-index-file` will be harder than just `-wmo`. This is because when calling the compiler and passing `-index-file` after `-dump-ast`, the option gets un-ignored by `Driver::buildOutputInfo`. Therefore, we will just ignore `-wmo` for now.

* Add tests, inspired by `Driver/batch_mode_with_WMO_or_index.swift`
2019-12-19 11:47:47 -08:00
swift_jenkins
9a7d347076 Merge remote-tracking branch 'origin/master' into master-next 2019-12-19 09:40:15 -08:00
David Ungar
b1f6a8941c Change to defaulting on 2019-12-19 07:38:59 -08:00
swift_jenkins
f421f1f3e9 Merge remote-tracking branch 'origin/master' into master-next 2019-12-19 00:59:44 -08:00
David Ungar
0291b36739 off-by-default & fix tests 2019-12-18 22:35:26 -08:00
David Ungar
2a79331ac3 add -enable/disable-only-one-dependency-file flag, on by default 2019-12-18 16:07:51 -08:00
swift_jenkins
3b15474d0b Merge remote-tracking branch 'origin/master' into master-next 2019-12-13 00:20:06 -08:00
David Ungar
73a46ce57e Revert "[Incremental, Driver] Only emit a real make-style dependency file for one frontend job." 2019-12-12 22:26:25 -08:00
swift_jenkins
fa658f594f Merge remote-tracking branch 'origin/master' into master-next 2019-12-11 21:39:59 -08:00
David Ungar
4c365a7735 Merge pull request #28702 from davidungar/only-one-dependency-file
[Incremental, Driver] Only emit a real make-style dependency file for one frontend job.
2019-12-11 21:21:41 -08:00
David Ungar
ecb74b54ae Make the new behavior the default. 2019-12-10 23:17:42 -08:00
David Ungar
46687189a7 -only-one-dependency-file causes only the first frontend job to emit a real dependency file. 2019-12-10 22:52:57 -08:00