Commit Graph

42290 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski
eb675c222e [Distributed] Correct tbd handling for distributed thunks (#74935) 2024-07-26 16:52:18 +09:00
eeckstein
2f1f3abff1 Merge pull request #75489 from swiftlang/revert-74909-generic-arg
Revert "[Sema] Add specialization constraints for func and variable types, then diagnose w/fixes."
2024-07-26 07:48:40 +02:00
Pavel Yaskevich
0343bb18af Revert "[Sema] Add specialization constraints for func and variable types, then diagnose w/fixes." 2024-07-25 15:43:15 -07:00
Nate Chandler
549b4a8bd9 [Test] Tweaked comment. 2024-07-25 13:52:21 -07:00
nate-chandler
840198ec9b Merge pull request #73275 from nate-chandler/lifetime-completion/enable
[LifetimeCompletion] Enable.
2024-07-25 12:29:44 -07:00
Greg Titus
47acc09e11 Merge pull request #74909 from gregomni/generic-arg
[Sema] Add specialization constraints for func and variable types, then diagnose w/fixes.
2024-07-24 19:38:11 -07:00
Kavon Farvardin
dfeb52b581 Merge pull request #75449 from kavon/kavon-fixes-2
Consume: warn about no-op consumes to be fixed
2024-07-24 19:04:52 -07:00
Venkatesh Sriram
82f85d83c2 Merge pull request #75219 from venkatesh5789/result-builder-extraction
[Compile Time Constant Extraction] Extract Result Builder Expressions
2024-07-24 18:27:17 -07:00
Nate Chandler
bff6c743a9 [LifetimeCompletion] Enable.
Complete all lifetimes during SILGenCleanup.
2024-07-24 17:56:31 -07:00
Kavon Farvardin
e04b35d709 Consume: warn about no-op consumes to be fixed
As of now, SE-366 is not correctly implemented with respect to concrete,
bitwise-copyable types like `Int`. Writing `consume someInt` doesn't
actually consume the variable binding as it should, meaning code that
should be flagged as having a use-after-consume is being silently
permitted:

```swift
let someInt = 10
let y = consume someInt
print(someInt) // no error!
```

This has been a problem since Swift 5.9. Eventually we plan to fix this
issue, which means code previously doing the above would become an
error. To help people get ready for the fix, start warning people that
these consumes are actually no-ops and suggest removing them until the
intended behavior is actually enforced in the future.

resolves rdar://127081103
2024-07-24 16:05:47 -07:00
Steven Wu
3f64d99a56 Merge pull request #75357 from cachemeifyoucan/eng/PR-132046247
[ExplicitModule] Include `-Xcc -D` into module hash
2024-07-24 15:50:02 -07:00
Greg Titus
6e917b567a Improve diagnoses of generic specializations
Always add constraints, find fixes during simplify.
New separate fix for allow generic function specialization.
Improve parse heuristic for isGenericTypeDisambiguatingToken.
2024-07-24 14:25:11 -07:00
Venkatesh Sriram
4c3439f942 [Compile Time Constant Extraction] Extract Result Builder Expressions 2024-07-24 10:08:24 -07:00
Allan Shortlidge
66e2f972ab Merge pull request #75432 from tshortli/maccatalyst-upstream
Upstream missing macCatalyst support
2024-07-24 09:58:04 -07:00
eeckstein
384d7f77a5 Merge pull request #75434 from eeckstein/fix-walkutils
WalkUtils: handle `unsafe_ref_cast` which casts between AnyObject and a class
2024-07-24 17:51:18 +02:00
Joe Groff
044d8c9f56 Merge pull request #75378 from jckarter/warn-on-runtime-function-symbol-references
Stage in a warning when trying to access symbols used by the compiler.
2024-07-24 08:18:57 -07:00
Alastair Houghton
fb3bc9543e [Linux][Driver][Options] Add -build-id option for the new driver.
This allows users of the Swift driver to specify a build-id on Linux.

rdar://116798309
2024-07-24 11:57:51 +01:00
Erik Eckstein
b739c6263b WalkUtils: handle unsafe_ref_cast which casts between AnyObject and a class
We need to ignore such casts because otherwise the constructed walking path wouldn't contain the right `existential` field kind.
Fixes a miscompile caused by redundant load elimination.

rdar://132364917
2024-07-24 11:35:08 +02:00
nate-chandler
1901aa7082 Merge pull request #75422 from nate-chandler/opt/20240722/1
[NFC] PrunedLiveness: Clarified boundary API.
2024-07-23 20:56:51 -07:00
Allan Shortlidge
f7ff3f0001 SILGen: Introduce macCatalyst support for @backDeployed.
Upstreams the necessary changes to compile references to `@backDeployed`
declarations correctly when a `macabi` target triple or a `-target-variant` is
specified.
2024-07-23 17:00:10 -07:00
Allan Shortlidge
6fb6a56b20 SILGen: Introduce macCatalyst support for if #available.
Upstream the necessary changes to compile `if #available` queries correctly
when a `macabi` target triple or a `-target-variant` is specified.
2024-07-23 17:00:10 -07:00
Allan Shortlidge
e4331af916 IRGen: Introduce macCatalyst target variant version check builtins. 2024-07-23 17:00:10 -07:00
Allan Shortlidge
d81f8db52f Merge pull request #75411 from tshortli/module-interface-lazy-typecheck-invalid-extension
ModuleInterface: Avoid crashing on invalid extensions in lazy typechecking mode
2024-07-23 15:49:57 -07:00
Kavon Farvardin
38d9c9f0f7 Merge pull request #75410 from kavon/kavon-fixes-1
Small Noncopyable Fixes, pt 1
2024-07-23 15:46:13 -07:00
Steven Wu
2bc4080116 [ExplicitModule] Include -Xcc -D into module hash
The decision to exclude `-Xcc -D` options from swift module hash
actually doesn't help to solve the problem. It wouldn't reduce the
module variants (or the number of swiftmodule build commands) because
the command-line also encodes all the clang PCM dependencies that do get
affected by `-Xcc` flags.

To avoid the false sharing and the nondeterministic build products,
include most of the `-Xcc` flags, except include search path, into swift
module hash.

rdar://132046247
2024-07-23 14:57:44 -07:00
Nate Chandler
812891cf81 [NFC] PrunedLiveness: Clarified boundary API.
When checking whether an instruction is contained in a liveness
boundary, a pointer to a DeadEndBlocks instance must always be passed.
When the pointer is null, it is only checked that the instruction occurs
within the direct live region.  When the pointer is non-null, it is
checked whether the instruction occurs within the region obtained by
extending the live region up to the availability boundary within
dead-end regions that are adjacent to the non-lifetime-ending portion of
the liveness boundary.
2024-07-23 13:38:35 -07:00
Kavon Farvardin
2557ba96c8 Noncopyable: deprecate '@_moveOnly' attribute
This hidden attribute is a leftover from before the '~Copyable' syntax.

rdar://130526083
2024-07-23 11:05:33 -07:00
Allan Shortlidge
a621059f80 ModuleInterface: Avoid crashing on invalid extensions in lazy typechecking mode.
With `-experimental-lazy-typecheck` specified during module interface emission,
`collectProtocols()` may be the first piece of code to request the extended
type for a given extension and it therefore needs to ignore invalid extensions
and ensure that diagnostics are emitted.

Also, add some `PrettyStackTrace` coverage to `ModuleInterfaceSupport.cpp` to make
investigating future issues easier.

Resolves rdar://126232836.
2024-07-23 10:32:50 -07:00
Jeremy Day
a22419f1d0 Fix sourcekitd persistent file-locks on Windows 2024-07-23 09:59:41 -07:00
Nate Chandler
e0da318129 [PrunedLiveness] Fix extended boundary check.
The areUsesWithinBoundary/areUsesOutsideBoundary methods take the
dead-ends because the region that they're checking for containment
within contains more than just (is a (non-strict) superset of) the
pruned live region.  On the other hand, the region also contains _less_
than (is a (non-strict) subset of) the available region.  Instructions
are in this extended region only if they're in a dead-end block which is
forwards reachable from the non-lifetime-ending liveness boundary.
2024-07-22 21:51:34 -07:00
Nate Chandler
aa8ccafd20 [OwnedLifetimeCan] Prune fewer debug_values.
Use the more precise areUsesWithinBoundary API (which takes dead-end
blocks into account).  This requires first updating liveness with the
newly created destroys.
2024-07-22 21:51:33 -07:00
Nate Chandler
001c41741a [NFC] OwnedLifetimeCan: Record new destroys.
Add them to a small vector.  For now, do nothing with them.
2024-07-22 21:51:33 -07:00
Nate Chandler
4a397cc018 [NFC] OwnedLifetimeCan: Take DeadEndBlocksAnalysis
All clients of OwnedLifetimeCanonicalization pass an instance of the
analysis in.  For now, it's unused.
2024-07-22 21:51:28 -07:00
Kavon Farvardin
6e35711bb4 Noncopyable: prevent keypaths from accessing
We don't yet have keypaths working correctly to allow access to
noncopyable fields, so we should raise a friendly error in Sema rather
than an error-out elsewhere vaguely.

resolves rdar://109287447
2024-07-22 21:22:05 -07:00
Nate Chandler
e125c5cf64 [NFC] SILOptimizer: Remove LexicalDestroyHoisting.
It has been superseded by OwnedValueCanonicalization's support for
lexical values.
2024-07-22 20:35:30 -07:00
Nate Chandler
afca04dd08 [OwnedLifetimeCan] Fix clearing.
Just clear all structures in a single method which is called wherever
clearing is done.  Fixes a failure to clear discoveredBlocks under
certain circumstances.
2024-07-22 20:35:29 -07:00
Nate Chandler
f31254150a [NFC] OwnedLifetimeCan: Extracted dead-end visit.
This is separate from deinit barrier visiting, and will be deleted once
complete lifetimes are finished.
2024-07-22 20:35:29 -07:00
Nate Chandler
800cd3f942 [NFC] OwnedLifetimeCan: Remove spurious array.
Inlined a single-caller method and removed the array that was created
only to be iterated over once.
2024-07-22 20:35:29 -07:00
rjmansfield
c21a3a974d Fix HelpText for -debug-inverse-requirements and -warn-long-expression-type-checking
Co-authored-by: Ryan Mansfield <ryan_mansfield@apple.com>
2024-07-22 18:46:22 +03:00
Hamish Knight
95b431e2ac Merge pull request #75391 from hamishknight/quick-cleanup 2024-07-22 09:57:21 +01:00
Hamish Knight
22b08da0dd [Sema] Remove replaceInvalidRefsWithErrors param
Doesn't seem like anything is relying on setting
this to `false` anymore, remove it.
2024-07-21 15:27:15 +01:00
Holly Borla
ee2dd82d56 Merge pull request #75235 from rofle100lvl/change_note_main_actor_variables
Change note for non marked with main actor global variables
2024-07-20 11:43:29 -07:00
Горбенко Роман
2c1e45a598 Changed note main actor variables 2024-07-20 02:39:33 +02:00
Joe Groff
8bc5a1f1fc Stage in a warning when trying to access symbols used by the compiler.
Attempting to bypass the compiler and access runtime functions directly has
a long history of breaking in hard-to-predict ways, and there's usually a better
way. Put up a warning to try to flush out misuses of runtime functions to see
if we can turn this into an error.
2024-07-19 16:55:11 -07:00
Joe Groff
9f2ee07de8 Merge pull request #75334 from jckarter/extern-is-experimental
`@_extern` is an experimental feature.
2024-07-19 09:04:14 -07:00
Susana Monteiro
2ab23ae1ca Merge pull request #75369 from swiftlang/susmonteiro/cxx-span-nonconst
[cxx-interop] Implements CxxMutableSpan, created from an UnsafeMutableBufferPointer
2024-07-19 14:08:51 +01:00
smonteiro2
684e9ebf0c [cxx-interop] Implements CxxMutableSpan, created from an UnsafeMutableBufferPointer
* Added tests for generic functions
* Add some tests for mutable spans
* Initialize ConstSpan from UnsafeMutableBufferPointer
* Change hardening flag
2024-07-19 10:38:52 +01:00
Michael Gottesman
ebedf63138 [region-isolation] Do not squelch use-after-transfer error even if the value is isolated to the same actor.
rdar://132074953
2024-07-19 02:25:53 -07:00
Michael Gottesman
10862642ca [region-isolation] Stub out PartitionOpEvaluator::doesFunctionHaveSendingResult() so that the unittests can override it.
The unittests for PartitionUtils pass in mocked operands and instructions that
cannot be dereferenced. Adding this static CRTP helper allows for the unittest
PartitionOpEvaluator subclass to just return false for it instead of
dereferencing operands or instructions. The rest of the evaluators just get to
use the default "normal" implementation that actually accesses program state.
2024-07-18 22:35:52 -07:00
Michael Gottesman
bcbf5c515e [region-isolation] Emit an error when we assign a non-disconnected value into a sending result.
rdar://127318392
2024-07-18 21:29:08 -07:00