Commit Graph

46689 Commits

Author SHA1 Message Date
Anthony Latsis
fec049e5e4 Address llvm::PointerUnion::{is,get} deprecations
These were deprecated in
https://github.com/llvm/llvm-project/pull/122623.
2025-07-29 18:37:48 +01:00
Gábor Horváth
cda069f419 Merge pull request #83371 from Xazax-hun/addressable-behind-feature-flag
[cxx-interop] Move addressable parameters in interop behind a flag
2025-07-29 12:42:33 +01:00
Andrew Trick
ab8091964b [NFC] add SinkAddressProjections::dump() 2025-07-29 00:10:59 -07:00
Allan Shortlidge
9302cbe568 Sema: Diagnose @dynamicMemberLookup subscripts that are not accessible enough.
Since this is a source breaking change, downgrade the diagnostic to a warning
until the next language version unless library evolution is enabled, in which
case this would have resulted in a broken `.swiftinterface` and it therefore
makes sense to diagnose eagerly.

Resolves rdar://156919010.
2025-07-28 22:36:39 -07:00
Gabor Horvath
f270e36aa5 [cxx-interop] Move addressable parameters in interop behind a flag
This unblocks the CI while we figure out some SILGen issues. We cannot
reuse AddressableParameters because that is already used in some
projects and consuming modules where the AddressableParameters flag was not
propagated to results in deserialization errors.
2025-07-28 23:29:22 +01:00
Charles Zablit
093bfc9208 [demangling] make printGenericSignature virtual 2025-07-28 18:19:55 +02:00
Erik Eckstein
b38490b2e2 SwiftCompilerSources: move PhiUpdater.swift from the Optimizer to the SIL module 2025-07-28 14:19:11 +02:00
Erik Eckstein
319f49ad9f SwiftCompilerSources: move the Verifier to the SIL module 2025-07-28 14:19:11 +02:00
Erik Eckstein
e95283ba38 SwiftCompilerSources: make the testing infrastructure available in the SIL module
add `Test`, which is the SIL-equivalent of `FunctionTest`.
It's invocation closure gets a `TestContext` instead of a `FunctionContext`.

^ The commit message #2 will be skipped:

^ - test
2025-07-28 14:19:10 +02:00
Erik Eckstein
65c9828cb3 SwiftCompilerSources: move the Context protocols from the Optimizer to the SIL module
This allows to move many SIL APIs and utilities, which require a context, to the SIL module.

The SIL-part of SwiftPassInvocation is extracted into a base class SILContext which now lives in SIL.

Also: simplify the begin/end-pass functions of the SwiftPassInvocation.
2025-07-28 14:19:07 +02:00
Allan Shortlidge
e27b4a583e Merge pull request #83357 from tshortli/non-public-setter-back-deployed-crash
AST: Skip serializing non-public accessors of `@backDeployed` properties
2025-07-28 02:27:12 -07:00
Allan Shortlidge
7d866bfe69 AST: Skip serializing non-public accessors of @backDeployed properties.
Avoids a crash in SILGen when skipping non-inlinable function bodies.

Resolves rdar://136853454.
2025-07-27 21:25:44 -07:00
Allan Shortlidge
67cc4c6ec3 Sema: Diagnose override availability for custom domains.
Resolves rdar://156159486.
2025-07-26 18:46:05 -07:00
Allan Shortlidge
60554b3de1 Sema: Fix rendering of accessor names in an availability diagnostic. 2025-07-26 15:36:46 -07:00
Allan Shortlidge
0fabfa3f99 Sema: Check custom domain availability during conformance checking.
Protocol requirement witnesses cannot only be available in a custom
availability domain if the requirement does not have the same availability
constraint.

Resolves rdar://156462516.
2025-07-25 21:30:53 -07:00
Allan Shortlidge
aa199aaf81 Correct misspelling of "availability" in a few places. 2025-07-25 21:30:53 -07:00
Allan Shortlidge
47b0e91f76 Merge pull request #83328 from tshortli/refactor-availability-constraint
AST: Simplify and clarify `AvailabilityConstraint`
2025-07-25 20:26:21 -07:00
Allan Shortlidge
0fa2ca38dc AST: Simplify and clarify AvailabilityConstraint.
Remove some unnecessary complexity from `AvailabilityConstraint`, rename some
of its members, and add more complete documentation.

NFC.
2025-07-25 15:15:03 -07:00
Doug Gregor
436e965b66 [SE-0466] Under main actor default isolation, explicit nonisolated is not special
Given an explicitly-nonisolated type such as

    nonisolated struct S { }

all extensions of S were also being treated as nonisolated. This meant
that being implicitly nonisolated (i.e., when you're using nonisolated
default isolation) was different from explicitly-writing nonisolated,
which is unfortunate and confusing. Align the rules, such that an
extension of S will get default isolation:

    extension S {
      func f() { } // @MainActor if we're in main actor default isolation
    }
2025-07-25 09:46:34 -07:00
Pavel Yaskevich
94b0b55837 Merge pull request #83286 from xedin/treat-std-string-as-default-literal-type
[ConstraintSystem] C++ Interop: Binding a string literal to `std.stri…
2025-07-25 00:05:14 -07:00
Augusto Noronha
2abdcc9db0 Merge pull request #83040 from augusto2112/sub-remote-addr
[NFC][RemoteInspection] Subtracting remote addresses should return int
2025-07-24 14:32:27 -07:00
Max Desiatov
b1eea5edd0 Merge pull request #82270 from al45tair/fix-embedded-concurrency
[Concurrency][Embedded] Make sure Embedded Swift links Impl functions.

Teach the Embedded Swift compiler to include the Impl functions for the functions that provide Concurrency hooks.

Also enable `MainActor` when building Embedded Swift stdlib for WASI.
2025-07-24 22:32:18 +01:00
Artem Chikin
c019093398 Merge pull request #75893 from artemcm/SwiftAPINotesVersionedProto
[APINotes] Add support for handling Clang modules carrying all versions of APINotes
2025-07-24 14:31:51 -07:00
Pavel Yaskevich
cd9c37cac6 [ConstraintSystem] C++ Interop: Binding a string literal to std.string shouldn't increase the score
Since this is a C++ stdlib type we need make sure that any overloads
that use it are preferred over custom types that also conform to
`ExpressibleByStringLiteral` when argument is a string literal.

This is important for operators like `==` which could be heterogenous
and have a custom C++ type that conforms to `ExpressibleByStringLiteral`
on either side together with `std.string` i.e.
`==(std.string, const CustomString &)`, such overloads should only
be selected if argument passed to `CustomString` is non-literal because
literals are convered by a stdlib `==(std.string, std.string)` overload.
2025-07-24 14:08:15 -07:00
Artem Chikin
b4f2821a89 Merge pull request #83050 from artemcm/AdoptVisibleClangModulesForOverlayDiscovery
[Dependency Scanning] Restrict Swift overlay lookup to "visible" Clang modules only
2025-07-24 09:14:25 -07:00
Artem Chikin
b60bc39ee5 [APINotes] Add support for handling Clang modules carrying all versions of APINotes
Controlled from Swift with '-version-independent-apinotes', which, for the underlying Clang invocation enables '-fswift-version-independent-apinotes', results in PCMs which aggregate all versioned APINotes wrapped in a 'SwiftVersionedAttr', with the intent to have the client pick and apply only those that match its current Swift version, discarding the rest.

This change introduces the configuration flags for this mode as well as the corresponding logic at the beginning of `importDeclImpl` to canonicalize versioned attributes, i.e. select the appropriate attributes for the current target and discard the rest.
2025-07-24 09:08:31 -07:00
Max Desiatov
729173274c Add linkWitnessTable to SILModule, use in Link.cpp 2025-07-24 14:58:21 +01:00
Allan Shortlidge
5d91d02bff Merge pull request #83280 from tshortli/print-as-clang-custom-availability-domains
PrintAsClang: Add support for custom availability domains
2025-07-24 06:17:05 -07:00
Meghana Gupta
40e372f80b Merge pull request #83211 from meg-gupta/fixcastopt3
Fix the optimization  of checked_cast_addr_br to scalar cast
2025-07-23 22:24:09 -07:00
Allan Shortlidge
58bf087a0e PrintAsClang: Add support for availability attrs with custom domains.
Resolves rdar://154510571.
2025-07-23 21:53:05 -07:00
Meghana Gupta
b90cd31d66 Fix optimization of checked_cast_addr_br to checked_cast_br 2025-07-23 17:03:13 -07:00
Doug Gregor
5023b90f93 Merge pull request #82921 from DougGregor/sendable-prohibits-mainactor-by-default
[SE-0466] Enable SendableProhibitsMainActorInference by default
2025-07-23 16:21:37 -07:00
Doug Gregor
858383c71d Merge pull request #83173 from DougGregor/shared-reference-of-incomplete
[Clang importer] Import incomplete SWIFT_SHARED_REFERENCE types
2025-07-23 13:11:56 -07:00
Augusto Noronha
40ed86e941 Merge pull request #83185 from augusto2112/opt-resolve-addr
[NFC] Stack allocate buffer in readRemoteAddressImpl instead of malloc
2025-07-23 11:52:53 -07:00
Kuba (Brecka) Mracek
407ef9a302 Merge pull request #83238 from kubamracek/const-cgfloat-typedef
[ClangImporter] Skip importing values for CGFloat typedefs on top of CGFloats direct
2025-07-23 10:43:24 -07:00
Artem Chikin
27305d6ccc [Dependency Scanning] Ensure all direct Clang module imports from Swift modules are always queried by-name to the Clang dependency scanner
This is required in order to always have computed the set of visible Clang modules for each Swift module in the graph. Otherwise when some Clang module gets cached as a transitive dependency from a query and is later looked up as a direct dependency, there will not be any computed visible modules set.
2025-07-23 10:02:52 -07:00
Artem Chikin
242585dcba [Dependency Scanning] Restrict Swift overlay lookup to "visible" Clang modules only
Previously Swift overlay lookup was performed for every directly and transitively-imported Clang module.

https://github.com/llvm/llvm-project/pull/147969 introduced the concept of "visible" Clang modules from a given named Clang dependency scanner query which closely maps to the set of modules for which Swift will attempt to load a Swift overlay. This change switches overlay querying to apply only to the set of such visible modules.

Resolves rdar://144797648
2025-07-23 09:25:26 -07:00
Crazy凡
061ce725d7 [Diagnostics] Add fix-it to @main struct without main static function. 2025-07-23 15:04:26 +08:00
Meghana Gupta
83399f93e0 Merge pull request #83111 from meg-gupta/lifediag
Diagnose @_lifetime on targets that are Escapable
2025-07-22 22:54:35 -07:00
Anthony Latsis
c7b51edf0a Merge pull request #83204 from swiftlang/jepa-main
Address rebranch deprecations
2025-07-23 06:00:57 +01:00
Allan Shortlidge
21d23c317b Merge pull request #83247 from tshortli/refactor-requirement-check
Sema: Consolidate requirement check failures and refactor `RequirementCheck`
2025-07-22 20:53:25 -07:00
Doug Gregor
72be0e0851 [Clang importer] Import incomplete SWIFT_SHARED_REFERENCE types
Normally, Swift cannot import an incomplete type. However, when we are
importing a SWIFT_SHARED_REFERENCE type, we're always dealing with
pointers to the type, and there is no need for the underlying type to
be complete. This permits a common pattern in C libraries where the
actual underlying storage is opaque and all APIs traffic in the
pointer, e.g.,

    typedef struct MyTypeImpl *MyType;
    void MyTypeRetain(MyType ptr);
    void MyTypeRelease(MyType ptr);

to use SWIFT_SHARED_REFERENCE to import such types as foreign
references, rather than as OpaquePointer.

Fixes rdar://155970441.
2025-07-22 20:20:23 -07:00
Allan Shortlidge
e6186690a5 Sema: Consolidate requirement check failures and refactor RequirementCheck.
Consolidate some of the closely related protocol requirement check failures and
then turn `RequirementCheck` into a proper wrapper around a union of associated
values for `CheckKind`.

NFC.
2025-07-22 15:27:25 -07:00
Kuba Mracek
6ec280d4e1 [ClangImporter] Skip importing values for CGFloat typedefs on top of CGFloats direct 2025-07-22 10:10:15 -07:00
Meghana Gupta
222ee7389a Diagnose @_lifetime on targets that are Escapable
Lifetime dependencies can be attached to ~Escapable types only
2025-07-22 06:00:38 -07:00
Steven Wu
a24c34252f [SwiftCaching] Create standalone reproducer from swift caching build
Add a new option `-gen-reproducer` that when swift caching is used,
create a standalone reproducer that can be used to reproduce the
`swift-frontend` invocation.
2025-07-21 14:16:48 -07:00
Hamish Knight
cb0a21da2a Merge pull request #83170 from hamishknight/fix-assert
[IDE] Fix assertion failure in `PostfixCompletionCallback::Result::tryMerge`
2025-07-21 18:48:03 +01:00
Anthony Latsis
f8577a2731 IRGen: Address llvm::Type::getPointerTo deprecation
See https://github.com/llvm/llvm-project/pull/113331.
2025-07-21 12:37:15 +01:00
Anthony Latsis
2920ea84d1 Address llvm::(Mutable)ArrayRef ctor deprecations
See:
- https://github.com/llvm/llvm-project/pull/146113
- https://github.com/llvm/llvm-project/pull/146011
2025-07-21 12:36:53 +01:00
Slava Pestov
bb4f61e97b Merge pull request #83141 from slavapestov/fix-rdar82992151
Sema: Improve the infinite opaque return type check
2025-07-19 09:30:17 -04:00