Commit Graph

103370 Commits

Author SHA1 Message Date
Slava Pestov
fa4c30ed6f Merge pull request #82051 from slavapestov/fix-rdar127120469-6.2
[6.2] ASTPrinter: Fix printing of let properties inside @objc @implementation extensions
2025-06-06 14:11:38 -04:00
Steven Wu
cc0af1d4f8 [CAS] Allow uncached job from CAS based dependency scanning
Create a path that swift-frontend can execute an uncached job from
modules built with CAS based explicit module build. The new flag
-import-module-from-cas will allow an uncached build to load module
from CAS, and combined with source file from real file system to build
the current module. This allows quick iterations that bypasses CAS,
without full dependency scanning every time in between.

rdar://152441866
2025-06-06 11:08:44 -07:00
Pavel Yaskevich
fd79a85981 [Demangle] Implement missing Node::Kind::OutlinedInitializeWithTakeNoValueWitness
Implements de/remangler support for `WOB` manglings.

(cherry picked from commit 8e49860349)
2025-06-06 10:05:56 -07:00
Allan Shortlidge
7bf1b0a5bc Merge pull request #82047 from tshortli/back-deployed-attr-remap-6.2
[6.2] AST: Fix iOS -> visionOS version remap for `@backDeployed` attrs
2025-06-06 09:09:26 -07:00
Pavel Yaskevich
47925188ba [Concurrency] Fix SendableMetatype conformance failures to behave like Sendable ones
No warnings with minimal checking, warnings with `strict-concurrency=complete` and
if declaration is `@preconcurrency` until next major swift version.

Resolves: rdar://151911135
Resolves: https://github.com/swiftlang/swift/issues/81739
(cherry picked from commit e326cd00930ff042ba1595e7793af9aaf0208b97)
2025-06-06 08:51:05 -07:00
Pavel Yaskevich
2a3e2d0800 Merge pull request #82037 from xedin/rdar-146027395-6.2
[6.2][Concurrency] Downgrade errors to warnings when Sendable requirement is inferred from a preconcurrency protocol
2025-06-06 08:49:20 -07:00
Henrik G. Olsson
fc67649b46 Merge pull request #82003 from hnrklssn/ignore-unused-bounds-attributes-6.2
[ClangImporter] Look through __ended_by and __null_terminated (#81630)
2025-06-06 08:37:17 -07:00
Gábor Horváth
2b33c44796 [6.2][cxx-interop] Support Swiftifying C++ constructors
Explanation: We did not have support to generate swiftified overload for
initializers. This PR adds that support.
Issue: rdar://152112660
Risk: Low, the feature is localized to swiftified overloads.
Testing: Regression test added.
Original PR: #81947
Reviewer: @hnrklssn
2025-06-06 15:34:15 +01:00
Alex Hoppen
558644f7fa [Indexing] Don't verify mangling of USRs
Verifying USR mangling adds ~30% overhead to indexing times. Since an incorrect USR mangling doesn't result in a correctness issue at the same level as a miscompile, save those 30% in non-assert builds.
2025-06-06 08:37:43 +02:00
Allan Shortlidge
c9d5e4b26c Merge pull request #82038 from tshortli/language-modes-and-features-in-module-trace-6.2
[6.2] Frontend: Add language mode and enabled features to `.SWIFT_TRACE`
2025-06-05 23:35:32 -07:00
Slava Pestov
2c53876c19 ASTPrinter: Fix printing of let properties inside @objc @implementation extensions
A `let` here is really just a `var` with a `{ get }`.

Fixes rdar://problem/127120469.
2025-06-06 00:25:02 -04:00
Allan Shortlidge
339ab824a8 AST: Fix iOS -> visionOS version remap for @backDeployed attrs.
The version remapping for `@backDeployed` regressed due to a bug introduced by
https://github.com/swiftlang/swift/pull/81922.

Also, fix some visionOS tests that have gotten out of date because we don't
seem to be running them in CI.

Resolves rdar://152542983.
2025-06-05 19:20:38 -07:00
Artem Chikin
ed8d696395 Merge pull request #82026 from artemcm/DiagnoseMissingModulesSeenInSerializedSearchPaths_62
[6.2 🍒][Dependency Scanning] On failure to locate a module, attempt to diagnose if binary dependencies contain search paths with this module.
2025-06-05 18:32:12 -07:00
Nate Chandler
d8c6f9817c [TypeLowering] Record pack used in aggregate sig.
Every `LowerType::visit*` function eventually calls through to a
`LowerType::handle*` function.  After
https://github.com/swiftlang/swift/pull/81581, every
`LowerType::handle*` needs to set the `hasPack` flag based on the
passed-in type by calling `mergeHasPack`.  Add the missing call in the
`handleAggregateByProperties` function.

rdar://152580661
2025-06-05 17:45:14 -07:00
Arnold Schwaighofer
cf81104407 Merge pull request #80989 from aschwaighofer/loadable_by_address_fix_yields_pattern_subst_6.2
[6.2] LoadableByAddress: Fix shouldTransformYields to use (properly) substituted types
2025-06-05 17:16:31 -07:00
Allan Shortlidge
f82c0b71a2 Sema: Fix an unused variable warning. 2025-06-05 15:44:27 -07:00
Allan Shortlidge
4c34f08b99 SILOptimizer: Fix an unused variable warning. 2025-06-05 15:40:30 -07:00
Erik Eckstein
7435a0366a IRGen: Fix an unused static function warning.
Move a static inline function into the cpp file.

NFC.
2025-06-05 15:39:33 -07:00
Allan Shortlidge
473d83955b Frontend: Add language mode and enabled features to .SWIFT_TRACE.
To allow tooling to analyze use of language mode and experimental/upcoming
features, add that information to the `.SWIFT_TRACE` file.

Resolves rdar://152673681.
2025-06-05 15:09:39 -07:00
Pavel Yaskevich
fe2c8ef00a [Diagnostics] Use contains instead of has when non-Sendable type appears inside of a member type
(cherry picked from commit 3495c61840)
2025-06-05 14:48:20 -07:00
Pavel Yaskevich
ace1e527d1 [Concurrency] Downgrade errors to warnings when Sendable requirement is inferred from a preconcurrency protocol
If a type gets `Sendable` conformace requirement through another
`@preconcurrency` protocol the error should be downgraded even
with strict concurrency checking to allow clients time to address
the new requirement.

Resolves: rdar://146027395
(cherry picked from commit 6d45229367)
2025-06-05 14:48:01 -07:00
Pavel Yaskevich
a947450a4d [Concurrency] NFC: Rename ImpliedByStandardProtocol to ImpliedByPreconcurrencyProtocol
The new name better reflects the intention for this Sendable check kind.

(cherry picked from commit 7cca7225a1)
2025-06-05 14:48:01 -07:00
Pavel Yaskevich
82f04e5b78 [Concurrency] Clean-up duplicate code in checkSendableInstanceStorage
(cherry picked from commit e24196e365)
2025-06-05 14:48:01 -07:00
Artem Chikin
e37071bcd4 Add a new diagnostic group and documentation for the module-not-found failure which specifies that a missing module dependency can be found on a search path serialized in another Swift binary module dependency. 2025-06-05 10:24:56 -07:00
Artem Chikin
e67be5ad7a [Dependency Scanning] Serialized Swift binary module serialized search paths 2025-06-05 10:24:50 -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
eeckstein
121aa40595 Merge pull request #82012 from eeckstein/fix-licm-6.2
LICM: fix a wrong tuple type when splitting loads
2025-06-05 17:28:46 +02:00
Arnold Schwaighofer
300ba4c051 [6.2] LoopRotate: Fix a by reference map bug under reallocation
Issue:
When using a densemap subscript expression on both sides of an
assignment in the same statement of the same map we run into the issue
that the map can reallocate because of the assignment but we are
referencing the value of the RHS map subscript by reference --
i.e we can reference deallocated memory.

Not good.

Scope: A "silent" memory error that one might run into including the
reporter of the bug.

Risk: Extremely, low. The fix is spliting an assignment from a map value
to a map entry into: A value assignment of the map value to a local. And
then storing the local in the map entry forgoing the reference of
reallocated memory bug.

```
  valueMap[bfi] = valueMap[bfi->getBorrowedValue()];

=>

  auto mappedMValue = valueMap[bfi->getBorrowedValue()];
  valueMap[bfi] = mappedValue;
```

Reviewed by: Meghana G, Erik E., Joe G.

Testing: The fix was tested on the reporting project.

rdar://151031297
2025-06-05 07:09:22 -07:00
Pavel Yaskevich
608a37ad04 Merge pull request #81997 from xedin/using-for-default-isolation-in-file-context-6.2
[6.2][AST/Sema] SE-0478: Implement using declaration under an experimental flag
2025-06-05 00:44:21 -07:00
Erik Eckstein
9be5e2dc3b LICM: fix a wrong tuple type when splitting loads
When creating a tuple, the type needs to be specified because otherwise, if the original tuple has labels, it will cause a type mismatch verification error.

rdar://152588539
2025-06-05 07:21:35 +02:00
Konrad 'ktoso' Malawski
362783c0f8 [Distributed] Don't drop dist get accessors from witness tables.
This actually manifested as an pointer auth crash, but the real reason
being is that we messed up the order of elements in the witness table.
If we'd skip the accessor like this, the types we sign/auth with would
no longer align and manifest in a crash.

There is no real reason to skip this entry so we just bring it back, and
avoid making this special in any way.

This unlocks a few tests as well as corrects any distributed+protocol
use where a requirement distributed var was _followed by_ other
requirements.

resolves rdar://125628060
2025-06-05 12:16:20 +09:00
Doug Gregor
3604f8918c Merge pull request #81985 from DougGregor/non-sendable-metatype-capture-diag-fixes-6.2
[6.2] Minor fixes for the non-sendable meta type capture diagnostics
2025-06-04 17:59:17 -07:00
Ian Anderson
1c1177e9d2 Merge pull request #81968 from ian-twilightcoder/Isystem-feature-flag_6.2
[6.2][Option] Add a feature flag for -Isystem
2025-06-04 16:36:38 -07:00
Henrik G. Olsson
5ef54aaada [ClangImporter] Look through __ended_by and __null_terminated (#81630)
Previously we would not import decls containing these types. This was
not an issue, because they can only occur when -fbounds-safety or
-fexperimental-bounds-safety-attributes is passed to clang. When
SafeInteropWrappers is enabled we pass
-fexperimental-bound-safety-attributes to clang however, so these types
can now occur without the user specifying any -Xcc flags.

rdar://151611718
(cherry picked from commit ac068c2a6b)
2025-06-04 15:56:02 -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
f72efd8327 [TypeChecker] Disable use of using in macro extensions
(cherry picked from commit 83ac0f5042)
2025-06-04 13:23:17 -07:00
Pavel Yaskevich
e5501d485a [AST] NFC: Capitalize UsingSpecifier::nonisolated for consistency
(cherry picked from commit 21ec5924f7)
2025-06-04 13:22:34 -07:00
Pavel Yaskevich
76886eb82b [Diagnostics] Tailor using diagnostic to current use-case - default isolation
(cherry picked from commit ec9132cb5a)
2025-06-04 13:22:34 -07:00
Pavel Yaskevich
b65da0bee0 [Concurrency] Start using default isolation set in a file scope
Infer default actor isolation from `using` declaration in the
file scope and use it to override one that is set by `-default-isolation`
flag.

(cherry picked from commit 595c3b3a62)
2025-06-04 13:22:34 -07:00
Pavel Yaskevich
d3f8fd8fd7 [AST/Sema] Hide using declaration behind DefaultIsolationPerFile experimental feature
(cherry picked from commit c246a7a372)
2025-06-04 13:22:32 -07:00
Pavel Yaskevich
4f88004fc0 [AST] Don't print using declarations in swift interfaces
These declarations are effectively `fileprivate` at the moment
and should appear in swift interfaces.

(cherry picked from commit ad71e07cae)
2025-06-04 13:21:58 -07:00
Pavel Yaskevich
7d18588f93 [Concurrency] Add a request to retrieve default isolation of a file
The default isolation is computed based on `using` declaration
found in the file, if any.

(cherry picked from commit 36b77116bd)
2025-06-04 13:21:56 -07:00
Pavel Yaskevich
89c3b0ba41 [Parse] Implement parsing for using declarations
(cherry picked from commit 4ad27ba61e)
2025-06-04 13:16:55 -07:00
Pavel Yaskevich
8da356a1c2 [ASTGen] Implement bridging for using declaration
(cherry picked from commit 4b5105df5e)
2025-06-04 13:16:55 -07:00
Pavel Yaskevich
38ce1c230e [CodeCompletion] Implement completions in using declaration's specifier position
(cherry picked from commit 816ea9fda6)
2025-06-04 13:16:55 -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
Konrad `ktoso` Malawski
284487cc27 Merge pull request #81831 from ktoso/pick-irgen-mangling-fix-distributed 2025-06-05 05:06:52 +09:00
Henrik G. Olsson
18a3f083ba Merge pull request #81827 from hnrklssn/swiftify-fixes-6.2
Swiftify fixes for 6.2
2025-06-04 11:30:34 -07:00
nate-chandler
4225fbc5c8 Merge pull request #81959 from nate-chandler/cherrypick/release/6.2/rdar152431332
6.2: [DestroyAddrHoisting] Skip init_enum_data_addrs.
2025-06-04 10:42:21 -07:00
Doug Gregor
ed29e1fdcd Merge pull request #81934 from DougGregor/break-isolated-conformance-reference-cycle-6.2
Split conformance isolation request to eliminate a reference cycle
2025-06-04 10:26:52 -07:00