Commit Graph

45907 Commits

Author SHA1 Message Date
Allan Shortlidge
c99b19e450 AST/Sema: Make MemberImportVisibility a migratable feature.
The migration to `MemberImportVisibility` can be performed mechanically by
adding missing import declarations, so offer automatic migration for the
feature.

Resolves rdar://151931597.
2025-06-02 07:27:41 -07:00
Allan Shortlidge
f6124cbe13 AST: Simplify the interface of DiagnosticEngine::getBestAddImportFixItLoc().
For clarity, it should just take a `SourceFile`.
2025-06-02 07:27:33 -07:00
Konrad 'ktoso' Malawski
e18f553eab Correct priority cancellation handler signing once more
Resolves rdar://150378890 for real this time, verified on arm64e myself
2025-06-02 21:40:18 +09:00
Hamish Knight
38744ebd2f Merge pull request #81877 from hamishknight/x-of-hearts-6.2
[6.2] Change InlineArray sugar separator `x` -> `of`
2025-05-31 23:50:05 +01:00
Mishal Shah
76eac9b0e7 Merge pull request #81873 from bnbarham/cherry-use-toolchain-version
[6.2] Add the distribution tag to `-print-target-info`
2025-05-30 23:50:51 -07:00
nate-chandler
57651963f1 Merge pull request #81875 from nate-chandler/cherrypick/release/6.2/rdar152195094
6.2: [DestroyAddrHoisting] Don't destructure NE aggs.
2025-05-30 21:06:59 -07:00
Hamish Knight
f1c37f4e7d Change InlineArray sugar separator x -> of 2025-05-30 22:06:29 +01:00
Holly Borla
0a3e134c20 Merge pull request #81498 from nickolas-pohilets/mpokhylets/fix-80992-6.2
6.2: Fixed no copying IsIsolated flag when cloning subscript params
2025-05-30 13:57:40 -07:00
Artem Chikin
f24016f197 [Dependency Scanning] Bridge diagnostics emitted during bridging header scanning
Instead of simply dumping them to stderr.

Resolves rdar://151993075
2025-05-30 13:53:07 -07:00
Artem Chikin
34f22c6408 Merge pull request #81848 from artemcm/ClangRemapsForDepScanQueries_62
[6.2][Dependency Scanning] Add `ClangImporter`'s mandatory path remaps to dependency scanning query filesystem
2025-05-30 13:41:04 -07:00
Nate Chandler
c894bdffab [NFC] SIL: This utility takes a func not a module.
In preparation to use the function in the implementation.
2025-05-30 13:27:45 -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
Hamish Knight
fbd2b8d411 Merge pull request #81845 from hamishknight/range-expansion-6.2
[6.2] [SourceKit] Properly handle cursor info range for macro expansions
2025-05-30 10:57:46 +01:00
Doug Gregor
0ed5cff7cc Merge pull request #81744 from DougGregor/more-migratable-features-6.2
[6.2] Make `InferIsolatedConformances` and `StrictMemorySafety` migratable features
2025-05-30 00:52:37 -07:00
Artem Chikin
ca59242429 [Dependency Scanning] Add ClangImporter's mandatory path remaps to dependency scanning query filesystem
On creation, 'ClangImporter' adds overlay modulemap files for non-modular platform libraries (e.g. glibc, libstdc++), which allows Swift code to import and use those libraries.

This change adds the same filesystem overlay to dependency scanning queries by applying them to the filesystem instantiated for each depndency scanning worker. Without these overlays EBM builds cannot discover and use non-modular system libraries on non-Darwin platforms.

Resolves rdar://151780437
2025-05-29 13:35:14 -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
Hamish Knight
1d56f2e789 [SourceKit] Properly handle cursor info range for macro expansions
Make `getOriginalLocation` work with source ranges, and adjust the
cursor info logic to map the range into the original buffer. This
fixes the case where we were using bogus range lengths for macro
expansion decls.

rdar://151411756
2025-05-29 20:49:44 +01:00
Mike Ash
540f69acb2 Merge pull request #81825 from mikeash/globalactorreference-ptrauth-6.2
[6.2][Runtime] Add ptrauth attribute to TargetGlobalActorReference conformance pointer.
2025-05-29 14:04:03 -04:00
Joe Groff
ad12b7862f Merge pull request #81796 from jckarter/no-non-escapable-property-descriptors-6.2
[6.2] SILGen: Emit property descriptors for conditionally Copyable and Escapable types.
2025-05-29 07:52:39 -07:00
Mike Ash
b04c7d4c3b [6.2][Runtime] Add ptrauth attribute to TargetGlobalActorReference conformance pointer.
When the TargetGlobalActorReference conformance is an indirect pointer, the indirect pointer is signed when ptrauth is enabled.

rdar://151945202
(cherry picked from commit ea785c191c)
2025-05-28 21:12:55 -04:00
Doug Gregor
0c7c1fb1a7 Make the optional feature StrictMemorySafety migratable
This feature is essentially self-migrating, but fit it into the
migration flow by marking it as migratable, adding
`-strict-memory-safety:migrate`, and introducing a test.

(cherry picked from commit abad2fae0f)
2025-05-28 16:15:15 -07:00
Doug Gregor
a9d526269a Make InferIsolatedConformances a migratable upcoming feature
When migrating, provide warnings that add 'nonisolated' to nonisolated
conformances that don't already have it and would end up being inferred
to be isolated under the upcoming feature.

(cherry picked from commit a32782bcbc)
2025-05-28 16:15:12 -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
Joe Groff
5ca6ad9d5e SILGen: Emit property descriptors for conditionally Copyable and Escapable types.
Key paths can't reference non-escapable or non-copyable storage declarations,
so we don't need to refer to them resiliently, and can elide their property
descriptors.

However, declarations may still be conditionally Copyable and Escapable, and
if so, then they still need a property descriptor for resilient key path
references. When a property or subscript can be used in a context where it
is fully Copyable and Escapable, emit the property descriptor in a generic
environment constrained by the necessary conditional constraints.

Fixes rdar://151628396.
2025-05-27 20:18:58 -07:00
Konrad `ktoso` Malawski
ab46cc805a Merge pull request #81756 from ktoso/pick-wip-correct-signing-num
[6.2][Concurrency] Correct the signing of priority escalation handler
2025-05-28 06:03:46 +09:00
Meghana Gupta
b91b772b01 Merge pull request #81679 from meg-gupta/fixsubstne
[6.2] Fix use-after-free on substituting function type involving conditional ~Escapable with Escapable type
2025-05-27 12:46:52 -07:00
Michael Gottesman
81b94e27fc Merge pull request #81748 from gottesmm/release/6.2-151802975
[6.2][sema] Change non-sendable -> non-Sendable in diagnostics.
2025-05-27 08:19:54 -07:00
eeckstein
826bc76a71 Merge pull request #81736 from eeckstein/fix-mda-6.2
[6.2] SIL: define `mark_dependence_addr` to read and write to its address operand
2025-05-24 15:29:07 +02: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
Doug Gregor
e2ee46d724 Merge pull request #81743 from DougGregor/no-unchecked-6.2 2025-05-24 03:58:49 +01:00
Konrad 'ktoso' Malawski
fa817f951d [Concurrency] Correct the signing of priority escalation handler 2025-05-23 17:06:12 -07:00
Michael Gottesman
b8cf5aeb34 Updates for 6.2.
These were changes that were not updated in the previous commit due to merge conflict
resolution or that the test itself was not in 6.2.
2025-05-23 10:33:58 -07:00
Michael Gottesman
0d519a1acb [sema] Change non-sendable -> non-Sendable in diagnostics.
This matches send non sendable but importantly also makes it clear that we are
talking about something that doesn't conform to the Sendable protocol which is
capitalized.

rdar://151802975
(cherry picked from commit 3ed4059a60)
2025-05-23 10:31:05 -07:00
Pavel Yaskevich
7077ef5ccf Merge pull request #81737 from xedin/rdar-151720646-6.2
[6.2][TypeChecker] Improve diagnostics for access to actor-isolated values…
2025-05-23 10:12:46 -07:00
Doug Gregor
3eb28dcc81 Remove the note that suggests using @unchecked
`@unchecked Sendble` is dangerous, and almost always the wrong thing to
use. Don't have the compiler suggest it.

(cherry picked from commit a922e8e356)
2025-05-23 16:08:59 +01:00
Hamish Knight
6f437241f8 Merge pull request #81721 from hamishknight/macrotrail-6.2
[6.2] [IDE] Better handle macro trailing closures
2025-05-23 10:37:44 +01:00
Pavel Yaskevich
dd95c60c70 [TypeChecker] Improve diagnostics for access to actor-isolated values outside of the actor
Replaces generic `expression is 'async' but is not marked with 'await`
diagnostic with a tailed one for cases where there is an access to an
actor-isolated value outside of its actor without `await` keyword.

This makes the diagnostics for async and sync contexts consistent
and actually identifies a problem instead of simply pointing out
the solution.

Resolves: rdar://151720646
(cherry picked from commit 7a6ba8e8c58c58b3438f31fec06102d02bae81a5)
2025-05-22 23:52:02 -07:00
Erik Eckstein
30e138c48b SIL: define mark_dependence_addr to read and write to its address operand
This prevents simplification and SILCombine passes to remove (alive) `mark_dependence_addr`.
The instruction is conceptually equivalent to
```
  %v = load %addr
  %d = mark_dependence %v on %base
  store %d to %addr
```

Therefore the address operand has to be defined as writing to the address.
2025-05-23 07:53:14 +02:00
Pavel Yaskevich
8079f1b12b Merge pull request #81645 from xedin/alwaysInheritActorContext+Task-immediate-6.2
[6.2][Sema/stdlib] SE-0472: implement `@_inheritActorContext(always)` and adopt it in `Task.immediate` APIs
2025-05-22 21:27:26 -07:00
Artem Chikin
8140cbe7b2 Merge pull request #81682 from artemcm/CxxUnderlyingStdLibLookupRemap_62
[6.2 🍒][Dependency Scanning][C++ Interop] Remap lookup of Clang module `CxxStdlib` to `std`
2025-05-22 14:15:52 -07:00
Hamish Knight
fee6c5aee2 [Completion] Suggest trivial trailing closures for macros
Follow the same logic as function decl completion and suggest a
trailing closure for trivial cases.

rdar://150550747
2025-05-22 20:17:17 +01:00
Hamish Knight
c28d706fe6 [Completion] NFC: Factor out addMacroCallArguments 2025-05-22 20:17:17 +01:00
Hamish Knight
26517a1239 [SourceKit] Handle CustomAttrs arguments for placeholder expansion
Introduce a new ASTWalker option for walking CustomAttrs and use it
for the placeholder scanner to ensure we can expand placeholders in
attribute arguments.
2025-05-22 20:17:17 +01: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
Steven Wu
559734c6d0 [Caching] Remove CASFS clang module implemenation
Remove the CASFS based clang module implemenation as it is not longer
used.

(cherry picked from commit 3c81c1ca9f)
2025-05-22 11:13:36 -07:00
Steven Wu
4670acf7f9 [Caching] Reduce the number of cas ID passed on frontend commandline
Using IncludeTree::FileList to concat the include tree file systems that
are passed on the command-line. This significantly reduce the
command-line size, and also makes the cache key computation a lot
faster.

rdar://148752988
(cherry picked from commit 201e4faea7)
2025-05-22 11:12:31 -07:00
Andrew Trick
641cf0124f Merge pull request #81686 from atrick/62-lifedep-unprint-feature
[6.2] Diagnostic message: suppress printing "requires LifetimeDependence"
2025-05-22 06:50:55 -07:00
Michael Gottesman
63a436ec04 Merge pull request #81615 from gottesmm/release/6.2-rdar151394209
[6.2] Fix a few issues around nonisolated(nonsending) and  protocol witness thunks/vtable thunks
2025-05-22 00:04:01 -07:00
Andrew Trick
f0ec734c2e Diagnostic message: suppress printing "requires LifetimeDependence"
Adopters of the new Span and MutableSpan types should not encounter information
about an experimental feature when they attempt to use these types in
unsupported ways, such as simply returning them from a function.

Fixes rdar://151788740 (Diagnostic message: suppress printing "requires
'-enable-experimental-feature LifetimeDependence'")

(cherry picked from commit 6cc1a8d880)
2025-05-21 23:00:52 -07:00