Commit Graph

662 Commits

Author SHA1 Message Date
swift-ci
4a749b3e3d Merge remote-tracking branch 'origin/main' into rebranch 2023-10-05 16:59:34 -07:00
Allan Shortlidge
e1f2e25ed5 Frontend: Introduce -emit-api-descriptor flag.
An "API descriptor" file is JSON describing the externally accessible symbols
of a module and metadata associated with those symbols like availability and
SPI status. This output was previously only generated by the
`swift-api-extract` alias of `swift-frontend`, which is desgined to take an
already built module as input. Post-processing a built module to extract this
information is inefficient because the module and the module's dependencies
need to be deserialized in order to visit the entire AST. We can generate this
output more efficiently as a supplementary output of the -emit-module job that
originally produced the module (since the AST is already available in-memory).
The -emit-api-descriptor flag can be used to request this output.

This change lays the groundwork by introducing frontend flags. Follow up
changes are needed to make API descriptor emission during -emit-module
functional.

Part of rdar://110916764.
2023-10-05 11:40:53 -07:00
Evan Wilde
0453158f8e Merge remote-tracking branch 'main' into rebranch
Conflict in CAS options when
`std::vector<std::string> CacheReplayPrefixMap;` was added.

Conflicts:
  include/swift/Frontend/FrontendOptions.h

Resolution: Take both
2023-10-04 14:28:43 -07:00
Steven Wu
c8bc08107c Merge pull request #68684 from cachemeifyoucan/eng/PR-path-remapping
[CompilerCaching] Path Remapping for canonicalization
2023-10-04 12:57:27 -07:00
swift-ci
2e9555437f Merge remote-tracking branch 'origin/main' into rebranch 2023-09-29 20:19:54 -07:00
Alexis Laferrière
c15a576a1c [Sema] Introduce remarks about the source of each decl in API
Using `-Rmodule-api-import` the compiler prints a remark about the
import bringing in every decl used in public function signatures or
inlinable code. It also remarks on the source of conformances where they
are used and the source of typealias underlying types.
2023-09-28 13:00:04 -07:00
Steven Wu
5be305e839 [CompilerCaching] Teach CachedDiagnostics to replay with prefix map
Teach CachedDiagnosticsProcessor to replay diagnostics for all consumers
with a different path using a path prefix map. This allows diagnostics
to be replayed for the actual path on disk after the scanner
canonicalized the path for compilation.
2023-09-26 12:36:43 -07:00
Steven Wu
7b89afbb6e [DepScan] Teach dependency scanner to remap path for canonicalization
Allow DependencyScanner to canonicalize path using a prefix map. When
option `-scanner-prefix-map` option is used, dependency scanner will
remap all the input paths in following:
* all the paths in the CAS file system or clang include tree
* all the paths related to input on the command-line returned by scanner

This allows all the input paths to be canonicalized so cache key can be
computed reguardless of the exact on disk path.

The sourceFile field is not remapped so build system can track the exact
file as on the local file system.
2023-09-26 12:36:43 -07:00
Kuba Mracek
1d51a944c8 Add an alias for -import-objc-header flag: -import-bridging-header 2023-09-19 22:33:35 -07:00
swift-ci
ad377c4042 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-15 03:14:54 -07:00
Max Desiatov
2d37e5bd03 Legacy Driver: Make --ld-path option consistently use single dash (#68495)
The original `--ld-path` option hasn't been included in a released version yet, so it's ok to break.
The vast majority of other options on Swift Driver already use a single dash.
2023-09-15 10:57:14 +01:00
Shubham Sandeep Rastogi
7a1a3d61ed Add MCCAS options to swift and guard mccas.swift properly
Revert "Revert "Add driver options to swift to enable MCCAS.""

This reverts commit 0e8554bb15.
2023-09-12 14:10:59 -07:00
Evan Wilde
0e8554bb15 Revert "Add driver options to swift to enable MCCAS."
This reverts commit 3c949028e8.
2023-09-11 13:36:36 -07:00
Shubham Sandeep Rastogi
585c700965 Merge pull request #68138 from rastogishubham/MCCASSwift
Add driver options to swift to enable MCCAS.
2023-09-08 10:17:10 -07:00
Shubham Sandeep Rastogi
3c949028e8 Add driver options to swift to enable MCCAS.
To enable MCCAS, the following driver options have been added

-cas-backend: Enable MCCAS backend in swift, the option
-cache-compile-job must also be used.

-cas-backend-mode=native: Set the CAS Backend mode to emit an object
file after materializing it from the CAS.

-cas-backend-mode=casid: Emit a file with the CASID for the CAS that was
created.

-cas-backend-mode=verify: Verify that the object file created is
identical to the object file materialized from the CAS.

-cas-emit-casid-file: Emit a .casid file next to the object file when
CAS Backend is enabled.
2023-09-08 07:13:57 -07:00
Steven Wu
f5407533ee Merge pull request #68164 from cachemeifyoucan/eng/PR-swift-caching-option-declare
[Option][Caching] Clean up option caching exclusion list
2023-09-06 14:56:18 -07:00
Max Desiatov
a7ff6e995f Merge pull request #67956 from kabiroberai/kabir/ld-path-option
This PR defines an `--ld-path` option for the Swift Driver, which is forwarded to the Clang linker-driver option with the same name. This change is required to support the `toolset.linker.path` option in [SE-0387](https://github.com/apple/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md).

## See Also

Downstream: https://github.com/apple/swift-driver/pull/1416, https://github.com/apple/swift-package-manager/pull/6719.
2023-09-05 19:37:09 +02:00
Steven Wu
9ecb17acc2 [Option][Caching] Clean up option caching exclusion list
Systematically declare CacheInvariant options in TableGen file instead
of putting a list in the cache key computation function.
2023-08-28 09:24:10 -07:00
Allan Shortlidge
3a02629be4 Frontend: Make lazy typechecking a TC opt instead of a frontend action. 2023-08-28 08:28:56 -07:00
Doug Gregor
339d31fabb [Macros] Add a frontend flag -Rmacro-loading to remark on macro resolution
Macro implementations can come from various locations associated with
different search paths. Add a frontend flag `-Rmacro-loading` to emit
a remark when each macro implementation module is resolved, providing
the kind of macro (shared library, executable, shared library loaded
via the plugin server) and appropriate paths. This allows one to tell
from the build load which macros are used.

Addresses rdar://110780311.
2023-08-25 15:09:49 -07:00
Allan Shortlidge
54435aca4f Frontend: Introduce -experimental-lazy-typecheck action.
This action is currently just an alias of the `-resolve-imports` action.
However, it's named to more clearly reflect the purpose which is to do the
minimal typechecking needed in order to emit the requested outputs. This mode
is intended to improve performance when emitting `.swiftinterface` and `.tbd`
files.
2023-08-18 16:15:33 -07:00
Allan Shortlidge
5c762b1435 Frontend: Migrate several options to no longer be ignored in swiftinterfaces.
Frontend options should only be printed under `swift-module-flags-ignored:`
temporarily to prevent condfails for older development compilers that are still
in use (as a rule of thumb, swiftinterfaces should be compatible with compilers
that are up to 6 months old). None of the frontend flags that are currently
categorized as "ignorable" need to be ignorable anymore.
2023-08-16 20:57:50 -07:00
Kabir Oberai
49a38f755f Mark --ld-path as HelpHidden 2023-08-16 12:22:16 -04:00
Kabir Oberai
b6288528d6 Add ld-path driver option 2023-08-16 01:32:15 -04:00
swift-ci
933fa26c4e Merge pull request #65904 from gwynne/patch-1
Update `-strict-concurrency` help text
2023-08-14 11:12:59 -07:00
Artem Chikin
6ef79c4ba0 [Dependency Scanning] Specify Explicit Module output path to the scanner explicitly
Instead of the code querying the compiler's built-in Clang instance, refactor the
dependency scanner to explicitly keep track of module output path. It is still
set according to '-module-cache-path' as it has been prior to this change, but
now the scanner can use a different module cache for scanning PCMs, as specified
with '-clang-scanner-module-cache-path', without affecting module output path.

Resolves rdar://113222853
2023-08-10 11:11:05 -07:00
Artem Chikin
8501f99cb2 [Dependency Scanning] Add option to specify a separate Clang Dependency scanner module cache.
Clang dependency scanning produces scanner PCMs which we may want to live in a
different filesystem location than the main build module cache.

Resolves rdar://113222853
2023-08-10 11:10:18 -07:00
Rintaro Ishizaki
8aa277e21d [Macros] Update help message for '-load-plugin-executable'
Clarify the format of the option and semantics.

rdar://113646544
2023-08-09 13:26:22 -07:00
Saleem Abdulrasool
200563c2e6 Option: add -libc as an option for Swift tools
Ensure that we process `-libc` in `swift-symbolgraph-extract` and
`swift-api-extract`.  This option is used by Windows to determine the C
ABI to use and thus impacts the ABI exposed by the ClangImporter to the
Swift interface.  This partially enables the use of
`swift package dump-symbol-graph` on Windows.
2023-07-21 04:31:59 -07:00
Steven Wu
6cf7163aa1 [Option] Rename -cache-remarks to -Rcache-compile-job
Rename swift-frontend option for caching remarks to -Rcache-compile-job.
2023-07-18 13:36:17 -07:00
Steven Wu
b78b569450 [CAS] Consolidate compile cache flags
Rename `-enable-cas` to `-compile-cache-job` to align with clang option
names and promote that to a new driver only flag.

Few other additions to driver flag for caching behaviors:
* `-compile-cache-remarks`: now cache hit/miss remarks are guarded behind
  this flag
* `-compile-cache-skip`: skip replaying from the cache. Useful as a
  debugging tool to do the compilation using CAS inputs even the output
  is a hit from the cache.
2023-06-26 10:34:27 -07:00
Steven Wu
2b7d38dc16 [CAS] Improve swift cas options
Using the same CASOption from clang to communicate CAS configurations so
it is easier to exchange CAS configuration between them.
2023-06-26 10:34:26 -07:00
Rintaro Ishizaki
5791a2cb37 [Macros] Plugin search options group
'load-plugin-library', 'load-plugin-executable', '-plugin-path' and
'-external-plugin-path' should be searched in the order they are
specified in the arguments.

Previously, for example '-plugin-path' used to precede
'-external-plugin-path' regardless of the position in the arguments.
2023-06-14 15:46:39 -07:00
Steven Wu
b1f99b8e93 [CAS] swift dependency scanning using CAS for compiler caching (#66366)
Teach swift dependency scanner to use CAS to capture the full dependencies for a build and construct build commands with immutable inputs from CAS.

This allows swift compilation caching using CAS.
2023-06-12 10:55:53 -07:00
Alex Lorenz
b2a04aad0e [cxx-interop][driver] make '-emit-clang-header-path' a fully supported driver flag
This will let other build systems call it without relying on the frontend flag
2023-06-07 11:07:21 -07:00
Ellie Shin
3cd653d7ae Merge pull request #66226 from apple/es-alias-rename
Update module aliasing terms in diagnostics and comments
2023-06-01 15:51:25 -07:00
Ellie Shin
8c66776ce1 Update module aliasing terms in diagnostics and comments
s/underlying_name/real_name

rdar://110028578
2023-05-31 11:47:11 -07:00
Alexis Laferrière
261f32cb84 Merge pull request #66139 from xymus/r-module-recovery 2023-05-26 16:00:43 -07:00
Alexis Laferrière
4f66fcfadb [Serialization] Intro -Rmodule-recovery to remark about silent errors
Deserialization recovery silently drops errors and the affected decls.
This can lead to surprises when a function from an imported module
simply disappears without an explanation.

This commit introduces the flag -Rmodule-recovery to report as remarks
some of these previously silently dropped issues. It can be used to
debug project configuration issues.
2023-05-25 10:44:08 -07:00
Artem Chikin
4920e4af84 Merge pull request #66031 from artemcm/BreakOutOverlayDeps
[Dependency Scanning] Break out Swift Overlay dependencies into separate output category
2023-05-23 08:22:33 -07:00
Artem Chikin
5ca91786ec [Dependency Scanning] Break out Swift overlay dependencies into separate output category
Instead of being a part of 'directDependencies' on a module dependency info, make them a separate array of dependency IDs for Swift Source and Textual modules.

This will allow clients to still distinguish direct module dependencies imported from a given module, versus dependencies added because direct/transitive Clang module dependencies have Swift overlays.

This change does *not* remove overlay dependencies from 'directDependencies' yet, just adds them as a separate field on the module details info. A followup change will remove overlay and bridging header dependencies from 'directDependencies' once the clients have had a chance to adopt to this change.
2023-05-19 14:47:43 -07:00
Egor Zhdan
4e47aff532 [cxx-interop] Update help message for the driver flag
rdar://109524041
2023-05-18 19:38:13 +01:00
Gwynne Raskind
4d91cc6454 Fix -strict-concurrency help text to say minimal instead of explicit 2023-05-13 03:38:28 -05:00
Erik Eckstein
85052a1489 deprecate the -experimental-performance-annotations option
Performance annotations can now be used without specifying this option
2023-05-11 08:03:19 +02:00
Ellie Shin
e9f847d414 Merge pull request #65336 from apple/es-private
Print package-name in .private.swiftinterface only for better abstraction
2023-04-27 20:07:12 -07:00
Steven Wu
8cbf83f903 Mirror outputs into CAS using CASOutputBackend
When `-enable-cas` option is used, mirror the output into CAS so it can
be fetched from CAS with the cache key in the future.
2023-04-24 13:57:47 -07:00
Ellie Shin
b081404daa Print package-name in .private.swiftinterface only for better abstraction
Resolves rdar://107638447
2023-04-20 17:45:22 -07:00
Steven Wu
e2c494179d [CAS] Integrate CAS into swift compiler
Teach swift compiler about CAS to allow compiler caching in the future.
1) Add flags to initiate CAS inside swift-frontend
2) Teach swift to compile using a CAS file system.
2023-04-17 13:18:09 -07:00
Evan Wilde
82fbe9f865 Add new driver -gcc-toolchain argument
The option is only available in the new driver and passes search paths
to the clang importer and clang linker when working with a gcc
toolchain.
2023-04-12 10:47:21 -07:00
Alexis Laferrière
2b196f75ff [Frontend] Accept the compiler arg -library-level= 2023-03-29 16:41:33 -07:00