Commit Graph

46165 Commits

Author SHA1 Message Date
Michael Gottesman
abcc134621 Merge pull request #81542 from gottesmm/rdar150209093_rdar151394209
[concurrency] Fix a few issues around not emitted correct protocol witness and vtable thunks for nonisolated(nonsending)
2025-05-19 10:43:18 -07:00
Joe Groff
21c17901b9 SIL: Resilient types don't need to be treated as addressable-for-dependencies inside their resilience domain.
Outside of the resilience domain, they have to be treated as opaque and therefore potentially
addressable-for-dependencies, but inside of the resilience domain, we may take advantage of
knowing the type layout to load indirect parameters out of memory and break the (unnecessary)
dependency on a fixed memory location. Fixes rdar://151268401.

We do still however have problems when the type is actually `@_addressableForDependencies`
inside of its resilience domain (rdar://151500074). I'll fix that in a follow up.
2025-05-19 09:07:44 -07:00
Mykola Pokhylets
b138c2cc35 Updated logic for diagnosting implicit self capture to handle immutable weak capture (minor source-breaking change) 2025-05-19 16:31:01 +02:00
Anthony Latsis
1823d44de7 Merge pull request #81570 from AnthonyLatsis/acer-campestri
Sema: Fix UB in `NonisolatedNonsendingByDefault` migration diagnosis
2025-05-18 01:34:52 +01:00
Karoy Lorentey
d98002318d [stdlib][runtime] Establish Swift Stdlib/runtime version 6.3 2025-05-16 19:01:32 -07:00
Ben Barham
381684a389 [SourceKit] Remove diagnostics path calculation
The diagnostic group documentation now point to the swift.org URL rather
than the toolchain path, so it no longer needs to be passed all the way
through sourcekitd.

Resolves rdar://151500502.
2025-05-16 17:58:16 -07:00
Meghana Gupta
f7529eae86 Merge pull request #81520 from meg-gupta/disableverifysemantics
Add a new semantics attribute to disable SIL verification on a function
2025-05-16 15:38:32 -07:00
Anthony Latsis
f4e49d5a0a Sema: Fix UB in NonisolatedNonsendingByDefault migration diagnosis
The diagnostic can outlive the locally constructed attribute, which was
passed by pointer, if there is an active `DiagnosticTransaction`.
2025-05-16 21:13:08 +01:00
eeckstein
8596b2210d Merge pull request #81539 from eeckstein/integer-type-apis
Swift AST/SIL: some additions and improvements of Integer type APIs
2025-05-16 12:00:38 +02:00
Meghana Gupta
aa01b2ad06 Add a new semantics attribute to disable SIL verification on a function
This provides a way to disable verification per function instead of the entire module.
2025-05-15 14:30:28 -07:00
Michael Gottesman
ff1cbea576 [silgen] Begin placing isolation on protocol witness thunks.
This will cause tests today to crash since even though we are placing the
isolation now, to make it easier to read, I left in the old isolation selecting
code. This code uses the witness's isolation instead of the requirement's
isolation which is incorrect since the protocol witness thunk needs to look the
requirement from an ABI perspective since the two must be substitutable. The
crash comes from the ABI verification I added in earlier commits.
2025-05-15 14:10:43 -07:00
Slava Pestov
2eceb299c9 Merge pull request #81516 from slavapestov/fix-pack-task-dealloc
IRGen: Fix out-of-order task_dealloc with parameter pack metadata
2025-05-15 17:02:08 -04:00
Erik Eckstein
140b883b9a SIL: let TypeValueInst.value return an optional Int
and don't require the client to check if it's an integer type.
Also, implement `var value` natively and without bridging.
2025-05-15 21:29:02 +02:00
Erik Eckstein
dbd0af063c AST: add some BuiltinFixedArray and IntegerType APIs 2025-05-15 21:29:02 +02:00
Erik Eckstein
7f6fb74418 SILBridging: move BridgedInstruction.OptionalInt -> BridgedOptionalInt in BasicBridging.h 2025-05-15 21:29:02 +02:00
Alastair Houghton
7f97e8d10b Merge pull request #81472 from al45tair/eng/PR-151147606
[Concurrency] Add underscore prefixes for not yet official API.
2025-05-15 18:39:21 +01:00
Slava Pestov
be860a8e9c AST: Fix latent bug in TypeTransformer::transformPackElementType() 2025-05-15 12:22:21 -04:00
Pavel Yaskevich
917524de94 Merge pull request #81496 from xedin/inheritActorContext-alwayse
[AST/Sema/SIL] Implement `@_inheritActorContext(always)`
2025-05-15 08:17:30 -07:00
Slava Pestov
ccaf7e149f Merge pull request #81522 from slavapestov/fix-rdar151162470
AST: Fix two bugs with SelfProtocolConformance
2025-05-15 07:44:35 -04:00
Mykola Pokhylets
3e0de8672a Removed the feature and made changes unconditional 2025-05-15 10:52:09 +02:00
Mykola Pokhylets
49b706a811 Added experimental feature to allow weak let and immutable weak captures 2025-05-15 10:26:26 +02:00
eeckstein
0d3edd629b Merge pull request #81502 from eeckstein/debug-info-in-embedded
embedded: fix source location of diagnostics which appear in imported modules
2025-05-15 06:58:54 +02:00
Slava Pestov
52afa15a74 AST: Fix two bugs with SelfProtocolConformance
There were two problems that have been there for years:

- SubstitutionMap::lookupConformance() assumes that every concrete conformance
  in the path has a root normal conformance. But calling getRootNormalConformance()
  on a self conformance would assert.

- SelfProtocolConformance::getAssociatedConformance() was not implemented. While
  self-conforming protocols do not have associated types, they can inherit from
  other protocols, and we model this with an associated conformance requirement
  having a subject type of `Self`.

Both problems were hidden by the fact that ProtocolConformanceRef::subst()
directly handled self-conforming existentials without calling into the
substitution map. But that is the wrong place for other reasons. The refactoring
in a209ff8869 exposed both of the above issues.

Fixes rdar://problem/151162470.
2025-05-14 23:34:53 -04:00
Pavel Yaskevich
17b8f7ef12 [Sema] Validate that @_inheritActorContext is used only on @Sendable/sending and async/@isolated(any) parameters 2025-05-14 20:08:00 -07:00
Pavel Yaskevich
a4f6d710cf [Sema] Start propagating @_inheritActorContext(always) attribute to closures 2025-05-14 20:08:00 -07:00
Pavel Yaskevich
c0aca5384b [ASTGen] Transform @_inheritActorContext into a custom attribute with an optional modifier 2025-05-14 20:07:59 -07:00
Pavel Yaskevich
c050e8f75a [AST] Protect declarations with @_inheritActorContext(always) by a feature flag
This is going to avoid condfails when declarations are printed
in the swiftinterface files.
2025-05-14 20:07:59 -07:00
Pavel Yaskevich
04d46760bb [AST] Extend @_inheritActorContext attribute to support optional always modifier
By default (currently) the closure passed to a parameter with `@_inheritActorContext`
would only inherit isolation from `nonisolated`, global actor isolated or actor
context when "self" is captured by the closure. `always` changes this behavior to
always inherit actor isolation from context regardless of whether it's captured
or not.
2025-05-14 20:07:57 -07:00
Becca Royal-Gordon
36de3a85e9 Merge pull request #81459 from beccadax/mod-squad-serialize 2025-05-14 19:25:22 -07:00
Steven Wu
f2ef2d3d86 Merge pull request #81494 from cachemeifyoucan/eng/PR-remove-clang-module-cas-fs
[Caching] Remove CASFS based clang module implementation
2025-05-14 15:55:17 -07:00
Alexis Laferrière
ef84f0e1aa Sema: Update more diagnostics for @cdecl vs @objc 2025-05-14 13:13:03 -07:00
Alexis Laferrière
bb99891648 Sema: Use ForeignLanguage directly in diagnostic definitions 2025-05-14 12:54:33 -07:00
Becca Royal-Gordon
e71f837b1f [NFC] Stub module selector DeclNameRef/Loc members 2025-05-14 11:16:02 -07:00
Becca Royal-Gordon
d48ff3545d [NFC] Give withoutArgumentLabels() a context arg
It will soon need to allocate sometimes.
2025-05-14 11:16:02 -07:00
Becca Royal-Gordon
c3a61bee0e Add experimental feature for module selector 2025-05-14 11:16:02 -07:00
Steven Wu
1506a0d495 [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.
2025-05-14 09:35:03 -07:00
Steven Wu
3c81c1ca9f [Caching] Remove CASFS clang module implemenation
Remove the CASFS based clang module implemenation as it is not longer
used.
2025-05-14 09:35:03 -07:00
Hamish Knight
93c37b49c5 Merge pull request #81028 from hamishknight/fix-completion-sourceranges
[IDE] Avoid uses of `isBeforeInBuffer` in `TypeCheckASTNodeAtLocRequest`
2025-05-14 16:26:56 +01:00
Holly Borla
40b57094da Merge pull request #81022 from nickolas-pohilets/mpokhylets/fix-80992
Fixed no copying IsIsolated flag when cloning subscript params
2025-05-14 08:09:40 -07:00
Alastair Houghton
c0ccdffeb7 [Concurrency] Add underscore prefixes for not yet official API.
Custom main and global executors work hasn't passed Swift Evolution yet,
so we need to avoid leaking it as API until it does.

To that end, underscore all the things.

rdar://151147606
2025-05-14 11:57:06 +01:00
Hamish Knight
d00f45a0c6 [AST] Switch FuncDecl::get{Start,End}Loc to using early return 2025-05-14 11:42:26 +01:00
Hamish Knight
3c67271869 [AST] Handle a few more cases in getStartLoc()
Handle PatternBindingDecls with missing var locations, which can
happen for loop iterator vars, and FuncDecls with missing name and
func locations, which can happen for `defer`. Also while here make
sure we set the source location of a parser-produced ErrorExpr.
2025-05-14 11:15:42 +01:00
Erik Eckstein
5dc71aa0a5 AST/SIL: support source location in diagnostics for de-serialized debug info
Diagnostics only work with `SourceLoc` which is basically a pointer into a buffer of the loaded source file.
But when debug info is de-serialized, the SIL `Location` consists of a filename+line+column.
To "convert" this to a `SourceLoc`, the file must be loaded.
This change adds `DiagnosticEngine.getLocationFromExternalSource` for this purpose.
Also, the new protocol `ProvidingSourceLocation` - to which `SourceLoc` and `Location` conform - help to generalize the helper struct `Diagnostic` and make this "conversion" happen automatically.
2025-05-14 11:43:47 +02:00
eeckstein
7ff1066409 Merge pull request #81480 from eeckstein/fix-fso
FunctionSignatureOptimization: don't convert indirect `@in` to `@in_guaranteed` if the argument is mutated
2025-05-14 06:25:16 +02:00
eeckstein
01107f18da Merge pull request #81469 from eeckstein/temp-rvalue-elimination
TempRValueElimination: handle `store` instructions to the temporary stack location
2025-05-14 06:24:47 +02:00
Steven Wu
7025bf816b Merge pull request #81264 from cachemeifyoucan/eng/PR-148752988
[Caching] Reduce the number of cas ID passed on frontend commandline
2025-05-13 16:15:29 -07:00
Erik Eckstein
dc0e7a34ae SIL: Make the verifier's ImmutableAddressUseVerifier generally available
Also, make it more tolerant to instructions and builtins, which are not explicitly handled.
This avoids crashes when new instructions are added. We got lucky that this didn't happen so far.
2025-05-13 18:53:31 +02:00
Steven Wu
201e4faea7 [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
2025-05-13 09:20:13 -07:00
Ian Anderson
69c5a02686 Merge pull request #81269 from ian-twilightcoder/nostdimport-remove-framework-paths
[Driver][Frontend] -nostdimport and -nostdlibimport should remove the default framework search paths
2025-05-13 03:01:29 -07:00
Erik Eckstein
85a49dcbbc Optimizer: make salvageDebugInfo optional when deleting instructions
Add a boolean parameter `salvageDebugInfo` to `Context.erase(instruction:)`.
Sometimes it needs to be turned off because the caller might require that after erasing the original instruction the operands no users anymore.
2025-05-13 07:37:45 +02:00