Commit Graph

5034 Commits

Author SHA1 Message Date
Meghana Gupta
9604081c46 Serialize/deserialize lifetime dependencies on enum elements 2025-06-23 13:50:13 -07:00
Slava Pestov
15f968f269 AST: Call setExtendedNominal() instead of cacheOutput(ExtendedNominalRequest...) 2025-06-13 16:00:16 -04:00
Allan Shortlidge
aa1bce262c ModuleInterface: Canonicalize OS version numbers in loaded swiftinterfaces. 2025-06-10 08:22:38 -07:00
Artem Chikin
5dc42ffb0c [Dependency Scanning] On failure to locate a module, attempt to diagnose if binary dependencies contain search paths with this module.
Unlike with implicitly-built modules (prior to Swift 6 mode), explicitly-built modules require that all search paths be specified explicitly and no longer inherit search paths serialized into discovered Swift binary modules. This behavior was never intentional and is considered a bug. This change adds a diagnostic note to a scan failure: for each binary Swift module dependency, the scanner will attempt to execute a dependency scanning query for each serialized search path inside that module. If such diagnostic query returns a result, a diagnostic will be emitted to inform the user that the dependency may be found in the search path configuration of another Swift binary module dependency, specifying which search path contains the "missing" module, and stating that such search paths are not automatically inherited by the current compilation.
2025-06-05 10:24:43 -07:00
Pavel Yaskevich
64783057dc [Serialization] Prevent using declarations from being serialized
(cherry picked from commit bc61bfb442)
2025-06-04 13:23:18 -07:00
Pavel Yaskevich
d057429e9a [AST] Add new declaration - using
Initially this declaration is going to be used to determine
per-file default actor isolation i.e. `using @MainActor` and
`using nonisolated` but it could be extended to support other
file-global settings in the future.

(cherry picked from commit aabfebec03)
2025-06-04 13:16:55 -07:00
Meghana Gupta
637f8ef03e [6.2] Fix deserialization of lifetime dependencies on ast function types 2025-06-02 17:36:22 -07:00
Ben Barham
1f53e700fa Add the distribution tag to -print-target-info
Ideally this would also update the `--version` output to be overridden
by `SWIFT_TOOLCHAIN_VERSION`, but unfortunately various tools rely on
the current format (eg. swift-build).

(cherry picked from commit 3c098782b4)
2025-05-30 10:04:40 -07:00
Ian Anderson
17d89553ee Merge pull request #81621 from ian-twilightcoder/nostdimport-remove-framework-paths
[6.2][Driver][Frontend] -nostdimport and -nostdlibimport should remove the default framework search paths
2025-05-29 12:51:10 -07:00
Steven Wu
28360605e7 Merge pull request #81720 from cachemeifyoucan/eng/PR-release-148752988-151339073-151395300
[6.2][Caching] Swift Caching Dependency Scanning Improvements
2025-05-28 11:44:00 -07:00
Ian Anderson
44b2c08a5a [6.2][Driver][Frontend] -nostdimport and -nostdlibimport should remove the default framework search paths
-nostdimport and -nostdlibimport only remove the toolchain and usr/lib/swift search paths, and they leave the framework search paths intact. That makes it impossible to get a fully custom SDK environment. Make their behavior match clang's -nostdinc/-nostdlibinc behavior: treat framework and non-framework paths the same. In other words, -nostdinc removes *all* compiler provided search paths, and -nostdlibinc removes *all* SDK search paths.

Rename SkipRuntimeLibraryImportPaths to SkipAllImportPaths, and ExcludeSDKPathsFromRuntimeLibraryImportPaths to SkipSDKImportPaths to reflect their updated behavior.

Move the DarwinImplicitFrameworkSearchPaths handling from SearchPathOptions to CompilerInvocation, where RuntimeLibraryImportPaths is managed. Rename it to just ImplicitFrameworkSearchPaths, and filter for Darwin when it's set up so that all of the clients don't have to do Darwin filtering themselves later.

rdar://150557632
2025-05-23 22:12:45 -07:00
Pavel Yaskevich
e12201769d [AST/Sema/SIL] Implement @_inheritActorContext(always)
- Extend `@_inheritActorContext` attribute to support optional `always` modifier.
  The new modifier will make closure context isolated even if the parameter is not
  captured by the closure.
- Implementation `@_inheritActorContext` attribute validation - it could only be
  used on parameter that have `@Sendable` or `sending` and `@isolated(any)` or
  `async` function type (downgraded to a warning until future major Swift mode
  to avoid source compatibility issues).
- Add a new language feature that guards use of `@_inheritActorContext(always)` in swift interface files
- Update `getLoweredLocalCaptures` to add an entry for isolation parameter implicitly captured by `@_inheritActorContext(always)`
- Update serialization code to store `always` modifier

(cherry picked from commit 04d46760bb)
(cherry picked from commit c050e8f75a)
(cherry picked from commit c0aca5384b)
(cherry picked from commit a4f6d710cf)
(cherry picked from commit 6c911f5d42)
(cherry picked from commit 17b8f7ef12)
2025-05-22 11:32:35 -07:00
Steven Wu
ed4e035f97 [Caching] Remove capture clang extra files
After removing the CASFS implementation for clang modules, there is no
need to capture clang extra file that sets up the VFS for the clang
modules since all content imported by ClangImporter is dependency
scanned and available via include-tree. This saves more ClangImporter
instance when caching is enabled.

Update the test to check that clang content found via `-Xcc` VFS options
can currently work without capture the headermaps and vfs overlays.

(cherry picked from commit 1506a0d495)
2025-05-22 11:13:52 -07:00
Artem Chikin
eae522b206 [Dependency Scanning] Reduce number of module loaders instantiated for textual interface scanning sub-instance 2025-05-12 10:01:51 -07:00
Artem Chikin
fc23c6b460 [Dependency Scanning] Remove 'ClangImporter' instance from dependency scanning worker
Move relevant logic directly into the worker
2025-05-12 10:01:45 -07:00
Michael Gottesman
741e667214 [swift-settings] Increment the module format.
I forgot to do this in b34e2d72fb. This is just to
be careful.

(cherry picked from commit 9ab6a627b9)

Conflicts:
	lib/Serialization/ModuleFormat.h
2025-05-06 14:12:24 -07:00
Michael Gottesman
e04e15f125 [swift-settings] Now that we aren't using it immediately, remove it from tree.
We can always get it back from the git history.

rdar://150695113
(cherry picked from commit 9d59dbed17)

Conflicts:
	include/swift/AST/DiagnosticsSema.def
	include/swift/Basic/Features.def
	test/abi/macOS/arm64/concurrency.swift
	test/abi/macOS/x86_64/concurrency.swift
2025-05-06 14:12:23 -07:00
Meghana Gupta
cc72edb119 Introduce end_cow_mutation_addr instruction 2025-04-30 14:38:48 -07:00
Pavel Yaskevich
0af7032d91 [AST] Mark parameter declarations as caller isolated
When `nonisolated(nonsending)` parameter specifier is present
mark the declaration as caller isolated.

(cherry picked from commit 9bc96d4669)
2025-04-17 11:44:11 -07:00
Pavel Yaskevich
65f78f3c01 Merge pull request #80807 from xedin/se-0461-renamings-6.2
[6.2][SE-0461] Replace `@execution(...)` with `@concurrent` and `nonisolated(nonsending)`
2025-04-16 20:47:14 -07:00
Pavel Yaskevich
06f880e65c [AST/ASTGen/Sema/Serialization] Remove @execution attribute
Complete the transition from `@execution` to `@concurrent` and `nonisolated(nonsending)`
2025-04-16 13:18:52 -07:00
Steven Wu
dc045d3e66 Merge pull request #80688 from cachemeifyoucan/eng/PR-148538787-swift-6.2
[6.2][BridgingHeaderChaining] Bind bridging header module when load module
2025-04-16 12:21:46 -07:00
Pavel Yaskevich
d8c64c1ff0 [AST/Sema] Intoduce nonisolated(nonsending) as a replacement for @execution(caller) 2025-04-16 10:06:08 -07:00
Pavel Yaskevich
8598ec670d [AST/ASTGen] Introduce @concurrent attribute to replace @execution(concurrent) spelling 2025-04-16 10:06:08 -07:00
Doug Gregor
678ea3df35 Fix deserialization assertion involving isolated conformances
(cherry picked from commit f09cdc2893)
2025-04-14 16:38:31 -07:00
Steven Wu
496885702d [BridgingHeaderChaining] Bind bridging header module when load module
When loading a module with embedded bridging header, bind the bridging
header module in the context when bridging header auto chaining is used.
This is because all the bridging header contents are chained into a PCH
file so binary module with bridging header should reference the PCH file
for all declarations.

rdar://148538787
(cherry picked from commit 02ee2f4d62)
2025-04-09 10:31:41 -07:00
Alexis Laferrière
59adcae6c3 Merge pull request #80656 from xymus/deser-late-shadowing-6.2
[6.2] Serialization: Apply type-checking shadowing after deserialization filtering
2025-04-09 09:43:38 -07:00
Alexis Laferrière
764cd1fa32 Serialization: Bring back shadowing but only after the filtering
Followup fix to #80009. We can still get ambiguities from colliding
decls across modules with the deserialization filtering. Bring back
calling the general lookup shadowing after the filtering. This way it
won't use filtered out decls to hide potential candidates.

rdar://148286345
2025-04-08 15:01:31 -07:00
Allan Shortlidge
1cd636d9b3 Serialization: Encode custom availability domains.
When serializing `@available` attributes, if the attribute applies to a custom
domain include enough information to deserialize the reference to that domain.

Resolves rdar://138441265.
2025-04-08 10:35:32 -07:00
Hamish Knight
fd7c2595f2 [Basic] Introduce abortWithPrettyStackTraceMessage
Introduce a convenience for aborting while printing a given message
to a frame of the pretty stack trace. Use this in the existing places
where we're currently doing this.
2025-04-07 17:05:35 +01:00
Artem Chikin
281f84da0f [Compile Time Values] Rewrite the 'Diagnose Unknown Compile Time Values' diagnostic pass in Swift 2025-03-28 10:30:07 -07:00
Doug Gregor
a61c40054d Merge pull request #80337 from DougGregor/cast-prohibits-isolated-conformances
[SE-0470] Prohibit isolated conformances in dynamic casts that can't safely use them
2025-03-27 14:17:45 -07:00
Alejandro Alonso
dccbcf3cd7 Merge pull request #80318 from Azoy/fix-inline-array-sugar-serialization
[Serialization] Fix serialization for InlineArray sugar
2025-03-27 09:34:16 -07:00
Doug Gregor
e0b52cd20e [SIL] Extend checked-cast instructions with "prohibit isolated conformances" flag
When performing a dynamic cast to an existential type that satisfies
(Metatype)Sendable, it is unsafe to allow isolated conformances of any
kind to satisfy protocol requirements for the existential. Identify
these cases and mark the corresponding cast instructions with a new flag,
`[prohibit_isolated_conformances]` that will be used to indicate to the
runtime that isolated conformances need to be rejected.
2025-03-26 22:31:47 -07:00
Michael Gottesman
de7a62e13e Merge pull request #80312 from gottesmm/pr-126bc735b2d01c0f2f35f27268ff26d404b2fb16
[sil] Make SILFunctionTypeInfo a struct enum.
2025-03-26 18:05:57 -07:00
Becca Royal-Gordon
a5a84f188e Merge pull request #79466 from beccadax/abi-inspected-your-appearance
@abi checking
2025-03-26 15:28:39 -07:00
Slava Pestov
c4817696b6 Merge pull request #80281 from slavapestov/rdar136686001
RequirementMachine: Skip protocol type aliases that contain unbound dependent member types
2025-03-26 17:43:51 -04:00
Alejandro Alonso
b5e8f495f7 Fix serialization for InlineArray sugar 2025-03-26 12:37:34 -07:00
Becca Royal-Gordon
123447d160 Don’t add HasStorageAttr to ABI-only decls
It’s unnecessary, shouldn’t be serialized into module interfaces, and Swift doesn’t know how to compute it for an ABI-only decl since it doesn’t have accessors or an initial value.

No tests because enforcement isn’t in yet.
2025-03-26 10:47:14 -07:00
Andrew Trick
97b249bd11 Merge pull request #80263 from atrick/markdep-addr
SIL: add mark_dependence_addr
2025-03-26 10:33:42 -07:00
Michael Gottesman
8cfb029b5c [sil] Make SILFunctionTypeInfo a struct enum.
I am doing this in preparation for adding the ability to represent in the SIL
type system that a function is global actor isolated. Since we have isolated
parameters in SIL, we do not need to represent parameter, nonisolated, or
nonisolated caller in the type system. So this should be sufficient for our
purposes.

I am adding this since I need to ensure that we mangle into thunks that convert
execution(caller) functions to `global actor` functions what the global actor
is. Otherwise, we cannot tell the difference in between such a thunk and a thunk
that converts execution(caller) to execution(concurrent).
2025-03-26 10:23:44 -07:00
Adrian Prantl
84d313fedf Merge pull request #80283 from adrian-prantl/145226754
[LLDB] Turn off resilience bypass for textual swiftinterface files
2025-03-26 08:41:57 -07:00
Slava Pestov
32514119df Serialization: Add an assertion 2025-03-26 10:55:23 -04:00
Andrew Trick
e7000e4668 SIL: Add mark_dependence_addr 2025-03-25 23:02:42 -07:00
Adrian Prantl
6891cb37a2 [LLDB] Turn off resilience bypass for textual swiftinterface files
As the old comment indicates, it was not expected that build systems
would register binary swift modules produced from textual interfaces
with -add_ast_path, but we have found examples of the in the wild and
it leads to the most unexpected side effects. Fixing this is
straightforward, we can just check if a binary module was compiled
from a textual interface and then not bypass resilience.

rdar://145226754
2025-03-25 12:17:27 -07:00
Nate Chandler
a3ba93609e [DefaultOverrides] SIL de/serialization. 2025-03-25 07:22:40 -07:00
Slava Pestov
6463dcb9c9 Merge pull request #79703 from slavapestov/span-backward-deployment
Build CompatibilitySpan shim
2025-03-25 07:28:47 -04:00
Slava Pestov
0155b41b50 AST: Extend @_originallyDefinedIn to allow specifying module name for linker directive purposes
The module name changes the symbol mangling, and also causes
TBDGen to emit linker directives. To separate out these two
behaviors, introduce a terrible hack. If the module name
contains a semicolon (`;`), the part before the semicolon
is the module name for mangling, and the part after the
semicolon is the module name for linker directives.

If there is no semicolon, both module names are identical,
and the behavior is the same as before.
2025-03-24 17:56:45 -04:00
Artem Chikin
c36ae0d0d6 Merge pull request #79818 from artemcm/SeparateSDKExplicitModules
[Dependency Scanning] Add support for placing explicitly-built SDK modules into a separate module cache
2025-03-24 12:27:06 -06:00
Doug Gregor
731f58443c Address review feedback on AbstractConformance in ProtocolConformanceRef 2025-03-23 20:54:39 -07:00