Commit Graph

5222 Commits

Author SHA1 Message Date
Arnold Schwaighofer
25a071efc8 Add experimental feature @inline(always)
The intent for `@inline(always)` is to act as an optimization control.
The user can rely on inlining to happen or the compiler will emit an error
message.

Because function values can be dynamic (closures, protocol/class lookup)
this guarantee can only be upheld for direct function references.

In cases where the optimizer can resolve dynamic function values the
attribute shall be respected.

rdar://148608854
2025-09-30 08:36:26 -07:00
swift-ci
d5a03fa0e4 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-26 22:36:42 -07:00
Erik Eckstein
a322fd9209 Serialization: remove the IS_OSSA flag from the module file header 2025-09-26 08:01:08 +02:00
Erik Eckstein
2f124cf564 Remove the -enable-ossa-modules option.
OSSA modules are enabled by default.
The compiler still accepts this option but it has no effect.
2025-09-26 08:01:08 +02:00
swift-ci
6cf902227a Merge remote-tracking branch 'origin/main' into rebranch 2025-09-25 15:15:11 -07:00
Steven Wu
d579027c02 Merge pull request #84442 from cachemeifyoucan/eng/PR-issue-84088
[Caching] Allow prefix mapping for generated bridging header
2025-09-25 15:10:29 -07:00
swift-ci
0e71bd5b51 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-25 14:16:45 -07:00
Steven Wu
b7329f4ea7 [Caching] Allow prefix mapping for generated bridging header
To allow prefix mapping of the bridging header to achieve cache hit when
source files are located in different location, the generated chained
bridging header should not include absolute paths of the headers. Fix
the problem by concat the chained bridging header together.

Fixes: https://github.com/swiftlang/swift/issues/84088
2025-09-24 10:14:10 -07:00
Artem Chikin
48c2a328ec [Dependency Scanning] Add support for diagnosing invalid architecture swift binary module candidates
Refactor 'maybeDiagnoseTargetMismatch' to separately collect mismatching target variant modules in 'identifyArchitectureVariants' and rename it to 'handlePossibleTargetMismatch'.

Prior uses of 'maybeDiagnoseTargetMismatch' will continue diagnosing errors/warnings on only discovering incompatible swift binary module target variants.

A new overload of 'handlePossibleTargetMismatch', in 'SwiftModuleScanner', instead collects it as a discovered incompatible candidate, for diagnosis downstream.
2025-09-24 09:35:56 -07:00
Artem Chikin
c73869e479 Do not fail the build on only finding incompatible-architecture modules on 'canImport'
This change refactors the module loaders to explicitly take a parameter indicating whether or not the loader is handling a 'canImport' query, in order to avoid emitting an error when finding a dependency Swift binary module with only imcompatible architecture variants present.

Resolves rdar://161175498
2025-09-23 15:26:02 -07:00
swift-ci
efdca7809a Merge remote-tracking branch 'origin/main' into rebranch 2025-09-16 15:42:34 -07:00
Allan Shortlidge
4841bcffa1 ModuleInterface: Print imports with @preconcurrency in swiftinterface files.
When a module has been imported `@preconcurrency` in source, when it is printed
in a `swiftinterface` file it should be printed along with the attribute to
ensure that type checking of the module's public declarations behaves
consistently.

This fix is a little unsatisfying because it adds another a linear scan over
all imports in the source for each printed import. This should be improved, but
it can be done later.

Resolves rdar://136857313.
2025-09-15 17:33:13 -07:00
swift-ci
0d2c4ca9be Merge remote-tracking branch 'origin/main' into rebranch 2025-09-15 10:29:21 -07:00
Meghana Gupta
c764244df0 Merge pull request #84180 from meg-gupta/borrowandmutatepr
Add preliminary support for borrow accessors
2025-09-15 10:01:15 -07:00
swift-ci
48eb65ee53 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-11 08:04:53 -07:00
Doug Gregor
3ce46e8b1f Merge pull request #84213 from DougGregor/deserialize-generic-sig-less-fatal 2025-09-11 06:19:00 -07:00
Yuta Saito
ce39d0fc3f Merge pull request #84215 from kateinoigakukun/yt/fix-expose-wasm-serialization 2025-09-11 22:08:01 +09:00
Yuta Saito
81166b42e8 [wasm] Fix @_expose(wasm) serialization crash
https://github.com/swiftlang/swift/pull/82616 added a new exposure kind
for the `@_expose` attribute, but did not update the serialization
format to account for the new kind. This caused a crash when
serializing a module that used `@_expose(wasm)`.
2025-09-11 07:22:22 +00:00
Doug Gregor
f318cf328d [Serialization] Don't fatalError earlier than we have to
Noticed as part of rdar://160278232.
2025-09-10 16:43:15 -07:00
Meghana Gupta
1cff471c57 Introduce ResultConvention::Guaranteed and ResultConvention::GuaranteedAddress
ResultConvention::Guaranteed will be used by borrow accessors when the storage type can be returned by value.

ResultConvention::GuaranteedAddress will be used by mutate accessors and borrow accessors when the storage type
cannot be returned by value.
2025-09-09 14:45:40 -07:00
Meghana Gupta
9fe489ce22 Introduce borrow and mutate as new accessor kinds
And handle them in various covered switches
2025-09-09 14:30:26 -07:00
swift-ci
e84e776fc3 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-09 07:15:59 -07:00
Gabor Horvath
f26749245b [SILGen] Fix the type of closure thunks that are passed const reference structs
This PR is another attempt at landing #76903. The changes compared to
the original PR:
* Instead of increasing the size of SILDeclRef, store the necessary type
  information in a side channel using withClosureTypeInfo.
* Rely on SGFContext to get the right ClangType
* Extend BridgingConversion with an AbstractionPattern to store the
  original clang type.
* The PR above introduced a crash during indexing system modules that
  references foreign types coming from modules imported as
  implementation only. These entities are implementation details so they
  do not need to be included during serialization. This PR adds a test
  and adds logic to exclude such clang types in the serialization
  process.

rdar://131321096&141786724
2025-09-09 12:07:52 +01:00
Doug Gregor
74e85c8416 [SIL] Track the parent module of a SIL global variable through serialization
As with SIL functions, track the parent module where a SIL global
variable was originally defined so that we can determine whether we
are outside of its original module for linkage purposes. Use this to
make sure we emit via a weak definition when emitting to a module
other than the originating module.

Fixes rdar://160153163.
2025-09-08 17:44:49 -07:00
swift-ci
a99470e579 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-08 07:13:18 -07:00
Richard Howell
7296b28b08 Debug prefix macro search paths
Macro search paths are generally absolute paths which will cause
non-deterministic output for build systems that build remotely.
When the -prefix-serialized-debugging-options flag is set remap
the macro search paths as well as the other debug paths.
2025-09-05 14:09:23 -07:00
swift-ci
07b17d605e Merge remote-tracking branch 'origin/main' into rebranch 2025-09-04 06:17:38 -07:00
Doug Gregor
ba2af97a91 Merge pull request #84095 from DougGregor/embedded-deferred-codegen 2025-09-04 06:05:39 -07:00
Doug Gregor
ed93b46fa6 [Embedded] Introduce DeferredCodeGen feature.
Introduce an experimental feature DeferredCodeGen, that defers the
generation of LLVM IR (and therefore object code) for all entities
within an Embedded Swift module unless they have explicitly requested
to not be emitted into the client (e.g., with
`@_neverEmitIntoClient`).

This feature is meant to generalize and subsume
-emit-empty-object-file, relying on lazy emission of entities rather
than abruptly ending the compilation pipeline before emitting any IR.

Part of rdar://158363967.
2025-09-03 15:55:47 -07:00
swift-ci
255ee32c29 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-03 13:48:19 -07:00
Pavel Yaskevich
0bcc9560b9 Merge pull request #83886 from janbaig/temp-branch
[SILGen] Remove and replace ad-hoc `assign_by_wrapper` instruction
2025-09-03 13:37:43 -07:00
swift-ci
7395dd8af2 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-03 12:20:00 -07:00
Hamish Knight
7fb532e4e6 Merge pull request #83776 from hamishknight/the-diags-never-stop-no
[Diags] Allow multiple in-flight diagnostics
2025-09-03 19:59:44 +01:00
JanBaig
ac8d630efb Remove newline 2025-08-29 16:48:19 -04:00
JanBaig
63888e34d9 Update SWIFTMODULE_VERSION_MINOR comment 2025-08-26 14:37:57 -04:00
Janat Baig
798c0f51a4 Merge branch 'main' into temp-branch 2025-08-23 11:11:04 -04:00
JanBaig
288c6d9553 Update SWIFTMODULE_VERSION_MINOR 2025-08-23 11:06:34 -04:00
JanBaig
52895fefc3 [SIL] Remove AssignByWrapper references from SIL passes 2025-08-22 23:20:53 -04:00
JanBaig
6f1ee54885 [SIL] Remove AssignByWrapper suport from SIL parsing and serialization 2025-08-22 23:17:54 -04:00
swift-ci
fd22790987 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-18 05:56:12 -07:00
Doug Gregor
4ff65cc244 Merge pull request #83784 from DougGregor/never-emit-into-client
Add @_neverEmitIntoClient to prohibit SIL serialization for a function
2025-08-18 04:19:59 -07:00
Doug Gregor
2f60d729f0 Add @_neverEmitIntoClient to prohibit SIL serialization for a function
Part of the Embedded Swift linkage model, this attribute ensures that
the function it applies to has a strong definition in its owning
module, and that its SIL is never serialized. That way, other modules
will not have access to its definition.

Implements rdar://158364184.
2025-08-17 23:21:57 -07:00
Doug Gregor
7a196ac3ba Merge pull request #83739 from DougGregor/embedded-weak-definitions-of-imports
[Embedded] Emit weak definitions for imported symbols
2025-08-17 20:25:02 -07:00
Doug Gregor
c91a4822d3 Serialize the "markedAsUsed" bit for SILGlobalVariable 2025-08-17 15:25:50 -07:00
Hamish Knight
89feb8fabb [Diags] Remove some now unnecessary calls to flush 2025-08-17 11:48:21 +01:00
swift-ci
ab9176fa4b Merge remote-tracking branch 'origin/main' into rebranch 2025-08-16 02:24:41 -07:00
Allan Shortlidge
678b0934d6 AST: Request-ify getting the AvailabilityDomain from a ValueDecl.
Cache the result of turning a `ValueDecl` into an `AvailabilityDomain`. Use
split caching to make the common case of the decl not representing an
availability domain efficient.

NFC.
2025-08-15 16:15:36 -07:00
swift-ci
fdc5b2bc73 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-14 19:55:30 -07:00
Doug Gregor
b5e61cc4ad [SIL] Serialize the markedAsUsed bit in SILFunction
We were dropping this bit during serialization, so we don't know
whether the function was originally marked as "used".
2025-08-14 16:48:45 -07:00
Allan Shortlidge
0bba9bbc26 AST: Make the decl associated with an AvailabilityDomain a ValueDecl.
A decl that represents an `AvailabilityDomain` should always be a `ValueDecl`.
2025-08-14 11:35:00 -07:00