Commit Graph

546 Commits

Author SHA1 Message Date
Stéphan Kochen
7b460ce495 build: fix accidental cmake expansions
As of CMake 3.25, there are now global variables `LINUX=1`, `ANDROID=1`,
etc. These conflict with expressions that used these names as unquoted
strings in positions where CMake accepts 'variable|string', for example:

- `if(sdk STREQUAL LINUX)` would fail, because `LINUX` is now defined and
  expands to 1, where it would previously coerce to a string.

- `if(${sdk} STREQUAL "LINUX")` would fail if `sdk=LINUX`, because the
  left-hand side expands twice.

In this patch, I looked for a number of patterns to fix up, sometimes a
little defensively:

- Quoted right-hand side of `STREQUAL` where I was confident it was
  intended to be a string literal.

- Removed manual variable expansion on left-hand side of `STREQUAL`,
  `MATCHES` and `IN_LIST` where I was confident it was unintended.

Fixes #65028.
2023-07-17 21:50:50 +02:00
Eric Miotto
ccae4228fe Merge pull request #64103 from finagolfin/rpath
[CMake] Don't add an extraneous rpath to the swift-frontend
2023-05-24 07:55:20 -07:00
Steven Wu
86927ef39c Merge pull request #65288 from cachemeifyoucan/eng/PR-swift-cache-backend
[CAS] Teach swift compiler to compute cache key and store outputs into CAS
2023-04-25 09:23:15 -07:00
Steven Wu
c153210505 [CAS] Add test case for cache key computation
Add tool swift-cache-tool for caching related testing and inspection.
2023-04-24 13:56:33 -07:00
Erik Eckstein
e7af73e2de Replace the swift-llvm-opt binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:53:12 +02:00
Erik Eckstein
2b2bc45e08 Replace the swift-dependency-tool binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:51:04 +02:00
Erik Eckstein
8ce6038a42 Replace the sil-passpipeline-dumper binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:49:33 +02:00
Erik Eckstein
e3a174b85e Replace the sil-llvm-gen binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:48:23 +02:00
Erik Eckstein
bc7b632d3e Replace the sil-nm binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:47:13 +02:00
Erik Eckstein
b6132d10e5 Replace the sil-func-extractor binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:45:22 +02:00
Erik Eckstein
2e9c241034 Replace the sil-opt binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:44:04 +02:00
Butta
db9e2865b2 [CMake] Don't add an extraneous rpath to the swift-frontend 2023-03-04 21:42:50 +05:30
Doug Gregor
5786cbd602 [Macros] Make the compiler frontend depend on the macro plugin libraries
The dependency of the Observation library on the observation macro
plugin introduces a direct dependency of a target library on a host
library, (lib -> stdlib) that we'd like to avoid. Instead, make the
Swift frontend binary depend on the macro plugin libraries that we
build, so that it's the complete host-side stack.
2023-03-03 14:58:42 -08:00
Doug Gregor
c0d53c4a47 [CMake] Fixup build for compiler plugin support library 2022-11-15 19:32:20 -08:00
Doug Gregor
c1e0ed6a4a Ensure that the compiler links against the plugin support library. 2022-11-15 19:32:20 -08:00
Doug Gregor
4b4751cc07 [CMake] Only add swiftCore dependency when the new Swift parser is included. 2022-10-07 10:19:06 -07:00
Doug Gregor
4da85ea091 Clean up build logic for ASTGen library.
Only introduce it and its dependency when the new Swift parser is being
built, and rely more on existing logic to make sure we get the right
build/link flags.
2022-10-07 10:19:05 -07:00
zoecarver
73a7c0ecc6 Apply Doug's review comments
(cherry picked from commit ddede209c7)
2022-10-07 10:18:40 -07:00
zoecarver
80200ec23a Add Swift-side infrastructure for ASTGen.
(cherry picked from commit 7bc67c9f12)
2022-10-07 10:18:40 -07:00
Eric Miotto
f417630054 Add option to reduce build times when using ThinLTO and ld64 (#41058)
Internal configurations targeting Darwin employ ThinLTO to
improve compiler performance, however using it on all executable
causes build time to increase with no matching benefit.

To reduce build times in such configurations, we allow some
ancillary targets to opt out of LLVM IR optimizations when linking
ThinLTO with ld64 (e.g. tools used for bootstrapping or debugging the
Swift compiler) -- this behaviour is opt in through a new flag
`--swift-tools-ld64-lto-codegen-only-for-supporting-targets`.

Addresses rdar://76702687
2022-02-09 08:22:02 -08:00
Casper Jeukendrup
78aec2937a One step towards supporting bootstrapping with Xcode
A `/${CMAKE_CFG_INTDIR}` was missing in a path. With Ninja, this does not matter because then it is always "". But with Xcode, it is "Debug", "Release", etc..
2022-01-14 01:01:15 +01:00
Erik Eckstein
3d33f11e6c cmake/build-script: rename the libswift option to "bootstrapping"
In cmake, rename LIBSWIFT_BUILD_MODE to BOOTSTRAPPING_MODE.
Also, rename the lit feature "libswift" to "swift_in_compiler".
2021-12-22 11:31:52 +01:00
Erik Eckstein
ba364a17ef libswift: rename cmake targets and functions
libswift -> swiftCompilerModules or swiftCompilerSources
2021-12-22 11:31:52 +01:00
Erik Eckstein
61db072617 cmake: fix libswift build dependencies
Unfortunately using the convenient "bootstrapping0-all", etc. custom targets does not work.
For some reason it does not cause a dependent file (like libswift's SIL.o) being rebuilt when a depenency (like swift-frontend from the previous bootstrapping stage) changes.
Instead we have to list al library- and executable-targets explicitly.
2021-11-23 18:33:43 +01:00
Erik Eckstein
09552abc44 libswift: improve the bootstrapping-with-hostlibs build mode
Don't build the swiftCore module files in the bootstrapping phases. Instead use the module files in the SDK.
This reduces the build time overhead from 3min -> 30seconds.
2021-11-05 18:32:25 +01:00
Artem Chikin
f8427829dc [SR-15135] Copy over early swift-driver executable to the build dir instead of creating a symlink
The SwiftDriver searches `swift-frontend` based on `Bundle.main.executablePath` (which internally uses `CFGetProcessPath`). This search dir is resolved differently on macOS and Linux so swift-frontend can't be found on Linux, forcing the driver to fallback to using the host system toolchain instead of the just-built one.
2021-10-22 13:57:19 -07:00
Erik Eckstein
af71088d29 libswift: bootstrapping build
Adding build modes for libswift: off, hosttools, bootstrapping, bootstrapping-with-hostlibs
The two bootstrapping modes are new. For details see libswift/README.md
2021-09-28 18:51:42 +02:00
Xi Ge
504cfb9573 link libswift later 2021-07-13 11:00:15 -07:00
Xi Ge
515cf21ba3 driver: refactor driver tool logics into a library. NFC 2021-07-13 10:03:12 -07:00
QuietMisdreavus
0cc6ce962a Merge pull request #38070 from apple/QuietMisdreavus/spi-comments
include comments on SPI symbols when they're in symbol graphs
2021-07-07 07:30:04 -06:00
Owen Voorhees
d5cf49b399 Merge pull request #37991 from owenv/digester-disable-fail-on-error 2021-06-30 22:35:56 -07:00
Victoria Mitchell
85fabb23ed include comments on SPI symbols when they're in symbol graphs 2021-06-30 16:13:08 -06:00
Owen Voorhees
734d7ae058 [APIDigester] Add a -disable-fail-on-error option 2021-06-20 11:00:13 -07:00
Xi Ge
aff404dfc6 ABIChecker: diagnose missing convenience inits only when checking source compatibility
rdar://76790246
2021-06-15 10:53:49 -07:00
swift-ci
e731f013ce Merge pull request #37703 from owenv/api-digester-lift-sdk-requirement 2021-06-12 12:45:02 -07:00
Artem Chikin
038af80a88 Merge pull request #37850 from artemcm/DriverForwardingArgumentStructure
Use `std::vector` for collecting arguments for swift-driver forwarding.
2021-06-09 15:46:51 -07:00
Artem Chikin
34af205d6e Use std::vector for collecting arguments for swift-driver forwarding.
Just something to try while we investigate whether SmallVector could be messing up the input to `execv`.
2021-06-09 10:48:56 -07:00
Erik Eckstein
809ce72e05 libswift: build support for the initial libswift
* add the (still empty) libswift package
* add build support for libswift in CMake
* add libswift to swift-frontend and sil-opt

The build can be controlled with the LIBSWIFT_BUILD_MODE cmake variable: by default it’s “DISABLE”, which means that libswift is not built. If it’s “HOSTTOOLS”, libswift is built with a pre-installed toolchain on the host system.
2021-06-09 11:25:15 +02:00
Owen Voorhees
e1befe4213 [APIDigester] Lift the requirement that -sdk must be present 2021-05-29 09:47:14 -07:00
Victoria Mitchell
d281722589 add symbol-graph flag to include SPI symbols
rdar://70794131
2021-05-20 15:10:49 -06:00
Xi Ge
e24eef4b35 driver: emit a warning when user specified flags to disable the new driver
rdar://78021402
2021-05-14 11:00:36 -07:00
Xi Ge
01b1aea958 Driver: diagnose options that are only supported in the new driver 2021-05-11 16:28:57 -07:00
Artem Chikin
4d7a4892f9 Merge pull request #37290 from artemcm/EnableDriverLinux
Enable `swift-driver` forwarding on non-Apple platforms.
2021-05-11 13:12:50 -07:00
Artem Chikin
6f44ba4ff1 Merge pull request #37122 from artemcm/BringBackNewDriver
Revert "Merge pull request #37114 from apple/revert-36377-NewDriverDefault"
2021-05-07 09:42:38 -07:00
artemcm
8e637eca41 Enable swift-driver forwarding on non-Apple platforms.
This removes the `#ifdef __APPLE__` guard that restricts this forwarding to Apple platforms only.
If a given build/toolchain does not build or include the `swift-driver` executable alongside the compiler executables, the driver will still safely default to the legacy driver.

Resolves rdar://75534188
2021-05-06 10:29:09 -07:00
Owen Voorhees
6b004f1060 [APIDigester] Replace llvm::cl with shared option tables 2021-05-01 09:20:14 -07:00
Owen Voorhees
d1c326851d Remove unused API digester options 2021-05-01 09:18:24 -07:00
Owen Voorhees
6e0a096ca0 Remove direct access to llvm option definitions outside of SwiftAPIDigesterInvocation.parseArgs 2021-05-01 09:18:24 -07:00
Owen Voorhees
288d3dffbe Begin refactoring API digester tool to use a SwiftAPIDigesterInvocation object for option parsing and config 2021-05-01 09:18:24 -07:00
Artem Chikin
ae2e856f9b Revert "Merge pull request #37114 from apple/revert-36377-NewDriverDefault"
This reverts commit 937e1a365c, reversing
changes made to a5440a8abd.
2021-04-28 15:11:36 -07:00