Commit Graph

2110 Commits

Author SHA1 Message Date
Alastair Houghton
55cda7dd85 Merge pull request #80795 from al45tair/eng/PR-149058236-6.2
[Concurrency] Remove -executor-factory option and replace with magic type.
2025-05-04 18:29:30 +01:00
QuietMisdreavus
61c4a0311f [6.2] [SymbolGraphGen] add flags to filter platforms out of availability metadata (#80806)
rdar://144379124
2025-04-21 14:48:43 -06:00
Doug Gregor
cf3bf78bb2 Merge pull request #80824 from DougGregor/diag-group-docs-on-swift-org-6.2
[6.2] Point at diagnostic group documentation on docs.swift.org
2025-04-16 05:29:33 -07:00
Steven Wu
bd23859a4a Merge pull request #80751 from cachemeifyoucan/eng/PR-148465899-6.2
[6.2][Caching][Macro] Make macro plugin options cacheable
2025-04-15 09:05:33 -07:00
Doug Gregor
4c99a0eccd Point at diagnostic group documentation on docs.swift.org 2025-04-15 07:03:25 -07:00
Alastair Houghton
670be7df63 [Concurrency] Remove -executor-factory option and replace with magic type.
We decided that using a magic typealias to set the executor factory was better
than using a compiler option. Remove the `-executor-factory` option, and replace
by looking up the `DefaultExecutorFactory` type, first in the main module, and
then if that fails in Concurrency.

rdar://149058236
2025-04-14 09:23:03 +01:00
Steven Wu
f96b81975a [Caching][Macro] Make macro plugin options cacheable
Currently, the macro plugin options are included as cache key and the
absolute path of the plugin executable and library will affect cache
hit, even the plugin itself is identical.

Using the new option `-resolved-plugin-validation` flag, the macro
plugin paths are remapped just like the other paths during dependency
scanning. `swift-frontend` will unmap to its original path during the
compilation, make sure the content hasn't changed, and load the plugin.
It also hands few other corner cases for macro plugins:

* Make sure the plugin options in the swift module is prefix mapped.
* Make sure the remarks of the macro loading is not cached, as the
  mesasge includes the absolute path of the plugin, and is not
  cacheable.

rdar://148465899
(cherry picked from commit 3d38d0dd56)
2025-04-10 16:52:15 -07:00
Nate Chandler
77055a5eb1 [CoroutineAccessors] Control ABI via flag. 2025-04-10 14:47:05 -07:00
Alastair Houghton
b1c345f1be Merge pull request #80266 from al45tair/custom-executors-take2
[Concurrency] Provide a Swift interface for custom main and global executors.
2025-03-31 09:53:48 +01:00
Doug Gregor
b182c96bd7 Print diagnostic group names by default
Print diagnostic groups as part of the LLVM printer in the same manner as the
Swift one does, always. Make `-print-diagnostic-groups` an inert option, since we
always print diagnostic group names with the `[#GroupName]` syntax.

As part of this, we no longer render the diagnostic group name as part
of the diagnostic *text*, instead leaving it up to the diagnostic
renderer to handle the category appropriately. Update all of the tests
that were depending on `-print-diagnostic-groups` putting it into the
text to instead use the `{{documentation-file=<file name>}}`
diagnostic verification syntax.
2025-03-29 15:40:56 -07:00
Doug Gregor
08b27804f0 Merge pull request #80378 from DougGregor/remove-educational-note-markdown-rendering
[Diagnostics] Remove rendering of educational notes to the terminal
2025-03-28 20:12:44 -07:00
Doug Gregor
7d569b989d [Diagnostics] Remove rendering of educational notes to the terminal
We're moving over to a model where we provide direct links to educational notes /
diagnostic group notes whenever relevant. Rendering the Markdown from these
files to the terminal is less relevant with this approach, so remove it from the
compiler.
2025-03-28 14:12:27 -07:00
Doug Gregor
2c822634dd Point educational notes at education notes / diagnostic groups markdown on Github
Rather than pointing at a Markdown file in the toolchain directory by default,
which won't render well immediately for most users, point at the sources on
GitHub, which will render it properly and will still work from (e.g.)
CI systems where the toolchain content might not be accessible.

Toolchain-aware diagnostic renders can look in the installed toolchain
location (share/doc/swift/diagnostics) for the markdown files for that
specific version of the markdown files.
2025-03-28 13:57:04 -07:00
Alastair Houghton
47fa71787f Revert "Merge pull request #80224 from glessard/revert-79789-custom-executors"
This reverts commit 06f6358067, reversing
changes made to 033f6679e8.
2025-03-28 10:15:07 +00:00
Becca Royal-Gordon
132f49108d Check attributes in @abi attr
This commit compares the attributes on the decl inside the `@abi` attribute to those in the decl it’s attached to, diagnosing ABI-incompatible differences. It also rejects many attributes that don’t need to be specified in the `@abi` attribute, such as ObjC-ness, access control, or ABI-neutral traits like `@discardableResult`, so developers know to remove them.
2025-03-26 10:47:57 -07:00
Kuba Mracek
1476c04761 Fix a 'misleading indentation' warning in CompilerInvocation.cpp 2025-03-25 13:43:36 -07:00
Kuba (Brecka) Mracek
41ae31647a Merge pull request #76045 from kubamracek/mergeable-traps
Add -Xfrontend -mergeable-traps as a way to emit mergeable traps
2025-03-25 07:13:18 -07:00
Kuba Mracek
b08f630c23 Fix incorrect computation of Opts.MergeableTraps 2025-03-24 14:51:43 -07:00
Pavel Yaskevich
8f4220c6fa Merge pull request #80219 from xedin/rdar-145768557
[Concurrency] SE-0466: Replace `UnspecifiedMeansMainActorIsolated` flag with `-default-isolation`
2025-03-24 09:05:07 -07:00
Kuba Mracek
ed5e89a501 Also respect -mergeable-traps when merging cond_fails in SILOptimizer 2025-03-24 09:04:44 -07:00
Kuba Mracek
164b61c83d Add -Xfrontend -mergeable-traps as a way to emit mergeable traps 2025-03-24 09:04:11 -07:00
Pavel Yaskevich
2221c140d2 [Frontend] SE-0466: Add -default-isolation frontend that accepts MainActor and nonisolated 2025-03-23 22:04:32 -07:00
Andrew Trick
afb0de5d3f LifetimeDependence: enable addressable dependencies 2025-03-23 19:00:42 -07:00
Doug Gregor
13f1bea2d3 Merge pull request #80209 from DougGregor/infer-isolated-conformances
Implement experimental feature InferIsolatedConformances
2025-03-22 17:53:20 -07:00
Dario Rexin
06f6358067 Merge pull request #80224 from glessard/revert-79789-custom-executors
Revert "[Concurrency] Provide a Swift interface for custom main and global executors."
2025-03-22 13:49:13 -07:00
Arnold Schwaighofer
05084acb4e Merge pull request #79199 from aschwaighofer/cond_fail_remarks
IRGen: Annotate LLVM IR of condfail with the condfail's message
2025-03-22 03:49:50 -07:00
Alastair Houghton
8b15b05c63 Revert "[Concurrency] Provide a Swift interface for custom main and global executors." 2025-03-22 02:38:11 -07:00
Doug Gregor
083194923c Implement experimental feature InferIsolatedConformances
Introduce the experimental feature InferIsolatedConformances to align
with the upcoming feature proposed in SE-0470. This is a slight
generalization of the main-actor-specific inference that was already
in place for the default-main-actor mode from SE-0466. Note that, as
specified in SE-0470, InferIsolatedConformances is implied by the
default-main-actor mode.
2025-03-21 11:41:46 -07:00
Alastair Houghton
8443b5f76c Merge pull request #79789 from al45tair/custom-executors
[Concurrency] Provide a Swift interface for custom main and global executors.
2025-03-21 09:05:03 +00:00
Arnold Schwaighofer
ee57eed78d IRGen: Annotate LLVM IR of condfail with the condfail's message
`-Xfrontend -enable-cond-fail-message-annotation`
LLVM IR produced by the Swift compiler will add the `annotation`
metadata attribute to the branch instruction generated for cond_fail
builtins.
2025-03-20 08:17:18 -07:00
nate-chandler
39f58de32e Merge pull request #80033 from nate-chandler/verify-each-flag
[IRGen] Add flags to control LLVM verify-each.
2025-03-17 07:35:17 -07:00
Nate Chandler
dd8c715aa6 [IRGen] Add flags to control LLVM verify-each.
Analogous to -sil-verify-all, the new flags cause LLVM verification to
be run after each LLVM optimization pass.
2025-03-14 17:51:43 -07:00
John Hui
76a1742aca [cxx-interop] Use formal C++ interop mode to fix name lookup in module interfaces (#79984)
It is possible for a module interface (e.g., ModuleA) to be generated
with C++ interop disabled, and then rebuilt with C++ interop enabled
(e.g., because ModuleB, which imports ModuleA, has C++ interop enabled).

This circumstance can lead to various issues when name lookup behaves
differently depending on whether C++ interop is enabled, e.g., when
a module name is shadowed by a namespace of the same name---this only
happens in C++ because namespaces do not exist in C. Unfortunately,
naming namespaces the same as a module is a common C++ convention,
leading to many textual interfaces whose fully-qualified identifiers
(e.g., c_module.c_member) cannot be correctly resolved when C++ interop
is enabled (because c_module is shadowed by a namespace of the same
name).

This patch does two things. First, it introduces a new frontend flag,
-formal-cxx-interoperability-mode, which records the C++ interop mode
a module interface was originally compiled with. Doing so allows
subsequent consumers of that interface to interpret it according to the
formal C++ interop mode. Note that the actual "versioning" used by this
flag is very crude: "off" means disabled, and "swift-6" means enabled.
This is done to be compatible with C++ interop compat versioning scheme,
which seems to produce some invalid (but unused) version numbers. The
versioning scheme for both the formal and actual C++ interop modes
should be clarified and fixed in a subsequent patch.

The second thing this patch does is fix the module/namespace collision
issue in module interface files. It uses the formal C++ interop mode to
determine whether it should resolve C++-only decls during name lookup.
For now, the fix is very minimal and conservative: it only filters out
C++ namespaces during unqualified name lookup in an interface that was
originally generated without C++ interop. Doing so should fix the issue
while minimizing the chance for collateral breakge. More cases other
than C++ namespaces should be added in subsequent patches, with
sufficient testing and careful consideration.

rdar://144566922
2025-03-13 23:24:18 -07:00
Artem Chikin
27bac69527 Merge pull request #79930 from artemcm/ClangTargetVariant
[Explicit Module Builds] Add '-clang-target-variant' flag
2025-03-13 07:21:09 -07:00
Alastair Houghton
55afa47bea [Concurrency] More work on the custom executor implementation.
Added an `-executor-factory` argument to the compiler to let you safely
specify the executors you wish to use (by naming a type that returns
them).

Also added some tests of the new functionality.

rdar://141348916
2025-03-13 13:34:41 +00:00
Artem Chikin
e96a690cc7 [Explicit Module Builds] Add '-clang-target-variant' flag
https://github.com/swiftlang/swift/pull/37774 added '-clang-target' which allows us to specify a target triple that only differs from '-target' by the OS version, when we want to provide a different OS version for API availability and type-checking, in order to set a common/unified target triple for the entire Clang module dependency graph, for presenting a unified API surface to the Swift client, serving as a maximum type-checking epoch.

This change adds an equivalent flag for the '-target-variant' configuration, as a mechanism to ensure that the entire module dependency graph presents a consistent os version.
2025-03-11 15:48:06 -07:00
Doug Gregor
7c8e99d4df Suppress memory-safety diagnostic for SwiftONoneSupport
It's a weird beast.
2025-03-10 16:16:43 -07:00
nate-chandler
c0ba520fac Merge pull request #79781 from nate-chandler/general-coro/20250227/1
[CoroutineAccessors] Dispatch and PtrAuth.
2025-03-07 20:08:42 -08:00
Nate Chandler
f5d03a6d11 [CoroutineAccessor] Remove old ABI support.
This was useful during bringup.  Now that retcon.once.dynamic coroutine
splitting is available, it's no longer needed.
2025-03-07 11:40:38 -08:00
Anthony Latsis
6a3903bb53 Revert "Revert "Introduce adoption mode for Swift features""
This reverts commit 393c59c078.
2025-03-05 15:21:01 +00:00
Rintaro Ishizaki
393c59c078 Revert "Introduce adoption mode for Swift features" 2025-03-04 19:13:05 -08:00
Anthony Latsis
2771f36ced LangOptions: Refactor feature state and API to account for adoption mode 2025-03-04 13:43:28 +00:00
Anthony Latsis
2a88419f5c Frontend: Do not suggest mode correction if adoption is not supported 2025-03-04 13:43:28 +00:00
Anthony Latsis
756abb9284 Frontend: Warn if adoption mode is requested but not supported 2025-03-04 13:43:28 +00:00
Anthony Latsis
2abf67872c Frontend: Parse a feature mode specifier 2025-03-04 13:43:28 +00:00
Anthony Latsis
90d1365a42 [NFC] Frontend: Give some variables better names 2025-03-04 13:34:44 +00:00
Andrew Trick
fa64a362a2 Add -Xfrontend -enable-address-dependencies
Temporary option to bootstrap '@'_addressable enforcement.

Once all the SILGen cases are handled, we won't need this option.
2025-03-03 16:21:48 -08:00
Mike Ash
beba678f04 Merge pull request #79302 from mikeash/singleton-metadata-pointer
[IRGen] Emit a pointer from nominal type descriptor to concrete metadata.
2025-02-28 15:24:36 -05:00
nate-chandler
f8b60bb6d2 Merge pull request #79685 from nate-chandler/general-coro/20250227/1
[CoroutineAccessors] Use swiftcorocc if available.
2025-02-28 12:06:54 -08:00
Shubham Sandeep Rastogi
1d28b5ccd1 Merge pull request #79308 from rastogishubham/CallSiteSwift
[DebugInfo]Generate call-site information in swift
2025-02-27 21:08:04 -08:00