Commit Graph

46165 Commits

Author SHA1 Message Date
Adrian Prantl
540df142d7 [RemoteInspection] Add a hook to process addresses before converting
them to hex strings when creating anonymous context descriptors. This
aims to solve a problem when LLDB reads reflection metadata directly
from local binary files instead of downloading them from in-process
memory.

LLDB's MemoryReader implements this to convert the file address into
an in-process address, so mangled names created from instance metadata
can be matched with the field info data read from the local files.

rdar://152743797
2025-06-06 16:24:18 -07:00
Saleem Abdulrasool
083cb114b3 Merge pull request #82065 from compnerd/import-shims
ClangImporter: import SwiftShims properly for static linking
2025-06-06 15:05:04 -07:00
Pavel Yaskevich
6bbc101a98 [Diagnostics] Correctly diagnose situations when immutable value is passed to inout parameter
Currently the note is going to point to the "callee" but that is
incorrect when the failure is related to an argument of a call.

Detect this situation in `RValueTreatedAsLValueFailure::diagnoseAsNote`
and produce a correct note.

Resolves: rdar://150689994
2025-06-06 14:36:19 -07:00
Pavel Yaskevich
aa92bcf9b0 Merge pull request #82004 from xedin/rdar-151911135
[Concurrency] Fix `SendableMetatype` conformance failures to behave l…
2025-06-06 14:07:55 -07:00
John McCall
237e617fab Merge pull request #82008 from rjmccall/dont-copy-print-options
Prevent PrintOptions from being implicitly copied
2025-06-06 17:06:02 -04:00
Steven Wu
debdd224d5 Merge pull request #81990 from cachemeifyoucan/eng/PR-152441866
[CAS] Allow uncached job from CAS based dependency scanning
2025-06-06 12:08:21 -07:00
Mike Ash
95977351ea Merge pull request #81955 from mikeash/os-unfair-recursive-lock-declarations
[Runtime] Don't redeclare os_unfair_recursive_lock et al if the SDK has them.
2025-06-06 13:05:24 -04:00
Artem Chikin
10cd7baef0 [Legacy Driver] Obsolete and remove batch compilation mode from the legacy driver
It is a maintenance burden and having the legacy driver exist in a simplified state reduces the possibility of things going wrong and hitting old bugs.
2025-06-06 09:51:00 -07:00
Saleem Abdulrasool
43b2b596fe ClangImporter: import SwiftShims properly for static linking
When building against the static standard library, we should define
`SWIFT_STATIC_STDLIB` to indicate to the shims that the declarations
should be giving hidden visibility and default DLL storage. This is
required to ensure that these symbols are known to be `dso_local` when
compiling to avoid an unnecessary look up through the PLT/GOT or the
indirection through the synthesized `__imp_` symbol and the IAT. This
corrects a number of incorrect code generation cases on Windows with the
static standard library.
2025-06-06 09:35:51 -07:00
Pavel Yaskevich
aaf153d7a1 [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
2025-06-06 08:48:29 -07:00
Pavel Yaskevich
f5b30b06b8 Merge pull request #82034 from xedin/rdar-152665294
[Demangle] Implement missing `Node::Kind::OutlinedInitializeWithTakeN…
2025-06-06 08:21:25 -07:00
Pavel Yaskevich
86d036ddca Merge pull request #81960 from xedin/rdar-146027395
[Concurrency] Downgrade errors to warnings when `Sendable` requirement is inferred from a preconcurrency protocol
2025-06-06 08:20:45 -07:00
eeckstein
a33ff9879a Merge pull request #81969 from eeckstein/temp-lvalue-elimination
Optimizer: improve TempLValueOpt
2025-06-06 15:30:29 +02:00
Slava Pestov
4d977535ff Merge pull request #82011 from slavapestov/clang-importer-assert
AST: Add assertion to BuiltinLiteralExpr::setBuiltinInitializer()
2025-06-06 02:50:57 -04:00
John Hui
f9e71d6770 [NFC] Silence unused variable warning in assert()
Clang complains that paramIndicesLength is unused. This block is already
guarded by CONDITIONAL_ASSERT_enabled(), so promoting assert() to
ASSERT() should not affect the behavior of assertions-disabled builds.
2025-06-05 17:01:05 -07:00
Steven Wu
8d5d758676 [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-05 14:55:42 -07:00
Pavel Yaskevich
8e49860349 [Demangle] Implement missing Node::Kind::OutlinedInitializeWithTakeNoValueWitness
Implements de/remangler support for `WOB` manglings.
2025-06-05 14:07:05 -07:00
Pavel Yaskevich
3495c61840 [Diagnostics] Use contains instead of has when non-Sendable type appears inside of a member type 2025-06-05 11:14:55 -07:00
Anthony Latsis
7c431c9a9a [NFC] Make a function static 2025-06-05 17:59:34 +01:00
John McCall
b3493bfa23 Prevent PrintOptions from being implicitly copied.
NFC *except* that I noticed a bug by inspection where we suppress
`@escaping` when print enum element types. Since this affects
recursive positions, we end up suppressing `@escaping` in places
we shouldn't. This is unlikely to affect much real code, but should
still obviously be fixed.

The new design is a little sketchy in that we're using `const` to
prevent direct use (and allow initialization of `const &` parameters)
but still relying on modification of the actual object.  Essentially,
we are treating the `const`-ness of the reference as a promise to leave
the original value in the object after computation rather than a
guarantee of not modifying the object. This is okay --- a temporary
bound to a `const` reference is still a non-`const` object formally
and can be modified without invoking UB --- but makes me a little
uncomfortable.
2025-06-05 12:52:01 -04:00
Doug Gregor
67b55566fe Merge pull request #82005 from DougGregor/generalize-checked-cast-options
[SIL] Generalize CastingIsolatedConformances to CheckedCastInstOptions
2025-06-05 08:43:09 -07:00
Alex Hoppen
021cdd4416 Merge pull request #81975 from ahoppen/sema-annotate-source-range 2025-06-05 13:49:54 +02:00
Mykola (Nickolas) Pokhylets
87e536ebec Merge pull request #80440 from nickolas-pohilets/mpokhylets/weak-let 2025-06-05 09:59:33 +02:00
Erik Eckstein
2b9b2d243c Optimizer: improve TempLValueOpt
* re-implement the pass in swift
* support alloc_stack liveranges which span over multiple basic blocks
* support `load`-`store` pairs, copying from the alloc_stack (in addition to `copy_addr`)

Those improvements help to reduce temporary stack allocations, especially for InlineArrays.

rdar://151606382
2025-06-05 06:45:18 +02:00
Slava Pestov
d7d5641487 AST: Add assertion to BuiltinLiteralExpr::setBuiltinInitializer()
I just spent way too long debugging an issue where a null pointer
was passed here, and SILGen crashed much later.
2025-06-04 23:51:46 -04:00
Doug Gregor
c1f7771e84 Merge pull request #81998 from DougGregor/raw-conformance-isolation-cleanup
Make (Raw)ConformanceIsolation requests work on the normal protocol conformance
2025-06-04 20:40:24 -07:00
Doug Gregor
bc4cf1236b [SIL] Generalize CastingIsolatedConformances to CheckedCastInstOptions
We are going to need to add more flags to the various checked cast
instructions. Generalize the CastingIsolatedConformances bit in all of
these SIL instructions to an "options" struct that's easier to extend.

Precursor to rdar://152335805.
2025-06-04 17:12:28 -07:00
Doug Gregor
2e1f876683 Make (Raw)ConformanceIsolation requests work on the normal protocol conformance
Reduce the burden on the evaluator's caching mechanism by handling the
unwrapping of a conformance down to its normal protocol conformance
outside of these requests. Thanks, Slava!
2025-06-04 17:12:06 -07:00
Artem Chikin
d4abba10a5 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-04 16:57:01 -07:00
Artem Chikin
aedc2fadb3 [Dependency Scanning] Serialized Swift binary module serialized search paths 2025-06-04 16:55:45 -07:00
Artem Chikin
90f2fba2ae [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-04 16:55:37 -07:00
Doug Gregor
68914528db Make (Raw)ConformanceIsolation requests work on the normal protocol conformance
Reduce the burden on the evaluator's caching mechanism by handling the
unwrapping of a conformance down to its normal protocol conformance
outside of these requests. Thanks, Slava!
2025-06-04 14:26:18 -07:00
nate-chandler
dd57d4dd85 Merge pull request #81952 from nate-chandler/rdar152431332
[DestroyAddrHoisting] Skip init_enum_data_addrs.
2025-06-04 10:32:36 -07:00
Doug Gregor
704cb81d93 Merge pull request #81963 from DougGregor/non-sendable-metatype-diag-group
Add a diagnostic group for the diagnostic about non-Sendable metatypes.
2025-06-04 09:41:51 -07:00
Alex Hoppen
c6c40de73d [IDE] Pass a SourceRange instead of a CharSourceRange in SemaAnnotator::passReference
Most `SemaAnnotator`s don’t actually care about the char source range. Instead, they only care about the start location of the reference, which is also included in `SourceRange`. Computing a `CharSourceRange` from a `SourceRange` is kind of expensive because it needs to start a new lexer.

To avoid this overhead, pass `SourceRange` to `SemaAnnotator::passReference` and related functions and let the clients compute the `CharSourceRange` when needed.

This reduces the overhead of index-while-building by about 10%.
2025-06-04 18:01:47 +02:00
Slava Pestov
c61a4fe333 Merge pull request #81949 from slavapestov/missing-part-of-se-0346
Sema: Implement missing part of SE-0346
2025-06-04 09:24:19 -04:00
Doug Gregor
9f0dda5417 Add a diagnostic group for the diagnostic about non-Sendable metatypes.
This is a new restriction that folks are sure to run into, so provide
it with some actionable documentation. Fixes rdar://152450956.
2025-06-03 16:45:28 -07:00
Nate Chandler
33d5c8648b [MemAccessUtils] Add to strip access storage casts
The new function stripAccessAndAccessStorageCasts is analogous to the
existing function stripAccessAndIdentityCasts but differs in that the
latter uses isAccessStorageIdentityCast whereas the new function uses
isAccessStorageCast.
2025-06-03 15:32:26 -07:00
Nate Chandler
974d179571 [MemAccessUtils] This instruction changes the type
moveonlywrapper_to_copyable_box changes the type so it's a type cast not
an identity cast.
2025-06-03 15:32:26 -07:00
Doug Gregor
9957f5240f Merge pull request #81933 from DougGregor/break-isolated-conformance-reference-cycle 2025-06-03 14:54:16 -07:00
Slava Pestov
cd5ecbee16 Sema: Implement missing part of SE-0346
The proposal states that this should work, but this was never
implemented:

    protocol P<A> {
      associatedtype A
    }

    struct S: P<Int> {}

- Fixes https://github.com/swiftlang/swift/issues/62906.
- Fixes rdar://91842338.
2025-06-03 17:28:19 -04:00
Mike Ash
650027e087 [Runtime] Don't redeclare os_unfair_recursive_lock et al if the SDK has them.
rdar://152340726
2025-06-03 16:38:22 -04:00
Mike Ash
47e5edeb3e Merge pull request #81874 from mikeash/remote-mirror-strip-protocol-pointers
[RemoteMirror] Strip protocol descriptor pointers when reading the conformance cache.
2025-06-03 14:49:58 -04:00
eeckstein
50c6824263 Merge pull request #81935 from eeckstein/min-pointer-value-option
IRGen: add an option `-min-valid-pointer-value` to override the target's LeastValidPointerValue
2025-06-03 19:21:58 +02:00
Pavel Yaskevich
b189b8a320 Merge pull request #81936 from xedin/improve-optional-wrappedValue-mismatch-diagnostics
[CSSimplify] Fix `matchDeepEqualityTypes` to allow fixing of optionals
2025-06-03 09:19:50 -07:00
Meghana Gupta
d1a97f1b0d Merge pull request #81879 from meg-gupta/fixdeserialization
Fix deserialization of lifetime dependencies on ast function types
2025-06-03 08:56:54 -07:00
Susana Monteiro
e910d9b2f8 Merge pull request #81709 from swiftlang/susmonteiro/ambiguous-use-of-method
[cxx-interop] Fix ambiguous methods in long chains of inheritance
2025-06-03 15:50:28 +01:00
Allan Shortlidge
adedf15270 Merge pull request #81922 from tshortli/visionos-availability-remap-regression
AST/Sema: Fix remapping of iOS availability in diagnostics for visionOS
2025-06-03 04:58:31 -07:00
Konrad `ktoso` Malawski
46a4c3ae94 Merge pull request #81899 from ktoso/wip-fix-for-real-ptr-auth 2025-06-03 20:03:06 +09:00
Erik Eckstein
c02bc2d421 IRGen: add an option -min-valid-pointer-value to override the target's LeastValidPointerValue
The LeastValidPointerValue is hard-coded in the runtime.
Therefore this option is only available in embedded swift - which doesn't have a runtime.

rdar://151755654
2025-06-03 09:27:35 +02:00