Commit Graph

46165 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski
85fcd69833 [Concurrency] Implement detecting isIsolatingCurrentContext user impls (#79946)
* [Concurrency] Detect non-default impls of isIsolatingCurrentContext

* [Concurrency] No need for trailing info about isIsolating... in conformance

* Apply changes from review
2025-03-18 09:39:11 +09:00
Alex Hoppen
829e03c104 Merge pull request #79974 from a7medev/feature/complete-single-option-decl-attrs 2025-03-17 15:40:00 -07:00
Michael Gottesman
13c9e9c994 [gardening] Remove this-> from LangOpts that was added by mistake. 2025-03-17 15:37:15 -07:00
Konrad `ktoso` Malawski
85e4685f90 [Concurrency] Adjust task escalation APIs to SE accepted shapes (#79988)
* [Concurrency] Adjust task escalation APIs to SE accepted shapes

* adjust test a little bit

* Fix closure lifetime in withTaskPriorityEscalationHandler

* avoid bringing workaround func into abi by marking AEIC
2025-03-18 07:05:11 +09:00
Steven Wu
6de939156d [ExplicitModule] Propagate deterministic check to explicit modules
Make `-enable-deterministic-check` a driver option and teach dependency
scanner to propagate the option to explicit module build commmands. This
allows to the option to check every build output from the compiler is
deterministic.
2025-03-17 14:58:11 -07:00
Allan Shortlidge
dd68e98002 Merge pull request #80051 from tshortli/refactor-semantic-decl-availability-request
AST: Introduce `DeclRuntimeAvailability`
2025-03-17 14:35:48 -07:00
Pavel Yaskevich
6c22036931 [CSSimplify] NFC: Perform assignments to a key path in a separate method
Previously key path type didn't have any requirements on their
root and value types but now that they do, we need a dedicated
place to perform an assignment and open/record all of the requirements.
2025-03-17 14:06:45 -07:00
Michael Gottesman
4b31382d67 [swift-settings] Only allow for a setting to be passed exactly once to #SwiftSettings.
This responds to some feedback on the forums. Most importantly this allows for
us to use variadic generics in the the type system to document whether we allow
for "appending" behavior or not. Previously, for some options we would take the
last behavior (and theoretically) for others would have silently had appending
behavior. This just makes the behavior simple and more explicit.
2025-03-17 14:03:52 -07:00
Slava Pestov
52b415e0a0 Sema: Remove unused method 2025-03-17 12:34:37 -04:00
Allan Shortlidge
7ed2a0def6 AST: Rename SemanticDeclAvailability to DeclRuntimeAvailability. 2025-03-17 09:13:43 -07:00
Allan Shortlidge
2309793b70 AST: Refactor SemanticDeclAvailabilityRequest.
Generalize the implementation of `SemanticDeclAvailabilityRequest` in
preparation for adding a new case to `SemanticDeclAvailability`. Use the
centralized availability constraint query instead of implementing a bespoke
algorithm for gathering constraints. Simplify `SemanticDeclAvailability` by
removing a case that is no longer relevant.

Part of rdar://138441307.
2025-03-17 09:10:32 -07:00
Pavel Yaskevich
b32a1caf53 Merge pull request #80032 from xedin/expand-scope-of-execution-attr
[AST/Sema] Allow `@execution(...)` attribute to be used on initializers and accessors
2025-03-17 09:01:41 -07:00
Rintaro Ishizaki
7693508b38 Merge pull request #80048 from rintaro/astgen-fixfix
[ASTGen] Misc fix
2025-03-17 08:58:06 -07:00
Mike Ash
6793952fdd Merge pull request #80018 from mikeash/eager-tracing-non-platform-binaries
[Runtime] Only use lazy os_signpost initialization for platform binaries.
2025-03-17 11:11:08 -04: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
Allan Shortlidge
fc2b5bebdc AST: Remove Decl::isSemanticallyUnavailable().
It can be replaced by querying the `AvailabilityContext` for a declaration
directly.
2025-03-16 23:33:56 -07:00
Rintaro Ishizaki
7add493002 [ASTGen] Generate '@_spi_available' attribute 2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
607d122fe9 [ASTGen] Handle several missing syntax
* MissingExpr: Generate ErrorExpr with previous token location
* MissingType: Generate ErrorTypeRepr with previous token location
* MissingPattern: Generate implicit '_' pattern for recovery
2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
ddd5b12661 [ASTGen] Handle trailing where clause in macro declarations 2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
a2e40d6c31 [ASTGen] Generate @_typeEraser attribute 2025-03-16 15:18:59 -07:00
Rintaro Ishizaki
d1f892cbdc [ASTGen] Generate '@reasync' and '@rethrows'
Also, fallback 'shouldBeRejectedByParser' attribute names to
'CustomAttr'.
2025-03-16 15:14:27 -07:00
Rintaro Ishizaki
9fc8bba26d [ASTGen] Fix 'RawDocCommentAttr' generation
* Generate only when 'AttachCommentsToDecls' lang option is enabled.
* Fix the range.
2025-03-16 15:00:29 -07:00
Rintaro Ishizaki
c90768f36e [ASTGen] Fix NamedOpaqueReturnTypeRepr
Generic parameter list was missing
2025-03-16 14:59:43 -07:00
Rintaro Ishizaki
bc668b6232 [ASTGen] Fix nullability
For 'arbitrary' macro names
2025-03-16 14:48:00 -07:00
Rintaro Ishizaki
996e72061a [ASTGen] Gnerate PlaceholderTypeRepr 2025-03-16 14:38:32 -07:00
Allan Shortlidge
2dd544a73c AST/Sema: Sink AvailabilityContext for location queries from Sema to AST. 2025-03-15 23:47:29 -07:00
Allan Shortlidge
151c9dee39 AST: Consolidate abstract/contrete syntax decl lookup functions. 2025-03-15 23:47:29 -07:00
Allan Shortlidge
02dcd5d8cf AST/Sema: Sink AvailabilityScopeBuilder from Sema to AST. 2025-03-15 23:47:29 -07:00
Allan Shortlidge
ff9b541c57 AST/Sema: Sink isExported() queries from Sema to AST. 2025-03-15 23:47:29 -07:00
Joe Groff
c949e6295f SIL: Lower fields that are conditionally addressable because of a dependency.
Parameters of generic type need to be treated as potentially
addressable-for-dependencies, but we don't want callers using the generic
function with concrete types that are known not to be addressable-for-
dependencies to be overconstrained. In SILFunctionType lowering, lower
these dependencies distinctly as conditionally addressable, meaning that
the dependency on an argument depends on whether the concrete type of
that argument is (potentially) addressable-for-dependencies or not.
2025-03-15 16:07:03 -07:00
Allan Shortlidge
017dae382e ClangImporter: Look up availability domains defined in bridging headers.
This is very brittle in this first iteration. For now we require the
declaration representing the availability domain be deserialized before it can
be looked up by name since Clang does not have a lookup table for availabilty
domains in its module representation. As a result, it only works for bridging
headers that are not precompiled.

Part of rdar://138441266.
2025-03-15 07:44:37 -07:00
Hiroshi Yamauchi
275a6792d1 Merge pull request #80007 from hjyamauchi/androidoverlay
Propagate sysroot to module loader subinvocation
2025-03-14 22:12:02 -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
Pavel Yaskevich
eeabaaee6c [AST/Sema] Allow @execution(...) attribute to be used on initializers and accessors 2025-03-14 17:28:53 -07:00
Meghana Gupta
c528afccf2 Fix ClosureLifetimeFixup to insert destroys at leaking blocks 2025-03-14 15:48:44 -07:00
Hiroshi Yamauchi
1a3a6e1c66 Propagate sysroot to module loader subinvocation
To fix the Android build issue https://github.com/swiftlang/swift/issues/79839
2025-03-14 12:38:40 -07:00
Pavel Yaskevich
26eaf7566d Merge pull request #80004 from xedin/se-0463-enablement
[Frontend] SE-0463: Enable `SendableCompletionHandlers` feature by default
2025-03-14 11:24:44 -07:00
eeckstein
418bd2208d Merge pull request #80013 from eeckstein/simplify-sil-type
AST/SIL: Refactor and cleanup `AST.Type`, `AST.CanonicalType` and `SIL.Type`
2025-03-14 18:10:25 +01:00
Mike Ash
b2fe7b4410 [Runtime] Only use lazy os_signpost initialization for platform binaries.
We don't emit signposts until something else has set them up, to avoid deadlocks when we're running in code that's involved in setting them up. But this means that Instruments will miss Concurrency events in a simple program that doesn't otherwise trigger setup of the logging system.

Since we must be in a platform binary if we're running in code that's setting up logging, we can check for that and only be lazy in platform binaries. Non-platform binaries can safely emit signposts eagerly.

rdar://142483658
2025-03-14 11:52:46 -04:00
Rintaro Ishizaki
3a4549b991 Merge pull request #79967 from rintaro/astgen-builtin-pound
[ASTGen] Generate miscellaneous builtin pound
2025-03-14 06:17:37 -07:00
Erik Eckstein
37455b6ab6 Optimizer: use formal types instead of SIL types for classifying dynamic casts.
Casts always work with formal rather than lowered types.
This fixes a potential bug when lowered types are different than formal types, like function types.
2025-03-14 09:45:27 +01:00
Erik Eckstein
d52f7d1619 AST/SIL: Refactor and simplify AST.Type, AST.CanonicalType and SIL.Type
* let `SIL.Type` conform to `TypeProperties` to share the implementation of common type properties between the AST types and `SIL.Type`
* call references to an `AST.Type` `rawType` (instead of just `type`)
* remove unneeded stuff
* add comments
2025-03-14 09:40:22 +01: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
Michael Chiu
7f0f2ac4dd Merge swiftlang#38335 2025-03-14 02:15:15 -04:00
Doug Gregor
4cc6411d05 Merge pull request #79983 from DougGregor/isolated-conformances-alignment
Align isolated conformances with the current proposal
2025-03-13 22:40:36 -07:00
Rintaro Ishizaki
ac80775201 [ASTGen] Generate miscellaneous builtin pound
`#error`, `#warning`, and `#assert`.
Also #_hasSymbol statement condition
2025-03-13 20:28:46 -07:00
Doug Gregor
c7fd48aa67 Rework storage for conformance isolation
Switch over to split caching for the conformance isolation request,
which optimizes for the common case where the conformance is
nonisolated. Also put the explicit global actor TypeExpr* in an
ASTContext side table, so we don't take a pointer's worth of storage
in every conformance.

For that side table, introduce a new "ASTContext::GlobalCache" that's
there only for side tables, so we don't have to go add get/set
operations to ASTContext and recompile the world every time we want to
add a side table like this.

Thanks, Slava!
2025-03-13 17:38:54 -07:00
Becca Royal-Gordon
f6c9177120 Merge pull request #79970 from beccadax/these-attributes-are-a-dump
[NFC] Add (better) dump methods for attributes
2025-03-13 15:45:14 -07:00
Pavel Yaskevich
4ce370d0b8 [Frontend] SE-0463: Enable SendableCompletionHandlers feature by default 2025-03-13 15:34:34 -07:00
Allan Shortlidge
d5fecf19d0 Merge pull request #79976 from tshortli/unique-custom-availability-domains
AST: Unique `CustomAvailabilityDomain` instances
2025-03-13 10:49:22 -07:00