Commit Graph

46165 Commits

Author SHA1 Message Date
Ian Anderson
a6e517e943 [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-12 22:33:48 -07:00
eeckstein
66e07f04ac Merge pull request #81441 from eeckstein/vector_base_addr
SIL: introduce the `vector_base_addr` instruction and use it in `InlineArray`
2025-05-13 06:52:42 +02:00
Anthony Latsis
efe53f0251 Merge pull request #81439 from ben-r-smith/known-size-set-doc-typo
Fix typo in KnownSizeSet documentation
2025-05-13 01:59:33 +01:00
Alejandro Alonso
9e24563bb7 Merge pull request #81365 from Azoy/my-existentials
[AST & Runtime] Correctly mangle extended existentials with inverse requirements
2025-05-12 13:21:07 -07:00
Erik Eckstein
a38db6439a SIL: add the vector_base_addr instruction
It derives the address of the first element of a vector, i.e. a `Builtin.FixedArray`, from the address of the vector itself.
Addresses of other vector elements can then be derived with `index_addr`.
2025-05-12 19:24:31 +02:00
Erik Eckstein
ff2341e83a Swift AST/SIL: add Type APIs for Builtin.FixedArray
* `Type.isBuiltinFixedArray`
* `Type.builtinFixedArrayElementType`
2025-05-12 19:24:31 +02:00
Artem Chikin
8ab726c2be Merge pull request #81361 from artemcm/DepScanFewerClangs
[Dependency Scanning][Refactor] Reduce the number of `ClangImporter` instances used by the scanner
2025-05-12 09:57:38 -07:00
Pavel Yaskevich
3854e61c49 Merge pull request #81428 from xedin/rename-some-task-apis
[stdlib] SE-0472: Rename `Task` and`*TaskGroup` APIs to match the pro…
2025-05-12 09:13:11 -07:00
Artem Chikin
d1adc24bbc Merge pull request #81415 from artemcm/CXXInteropDarwinCycleFix
[Dependency Scanning][C++Interop] Do not query `CxxStdlib` Swift overlay for textual modules which were not built with c++interop
2025-05-12 09:08:37 -07:00
Ben Smith
657179d503 Fix typo in KnownSizeSet documentation 2025-05-11 22:10:01 -07:00
Hamish Knight
cf461be864 Merge pull request #81414 from hamishknight/ref-nt
[Frontend] Avoid storing StringRef values in `ModuleAliasMap`
2025-05-10 14:11:56 +01:00
Pavel Yaskevich
001eab867d [stdlib] SE-0472: Rename Task and*TaskGroup APIs to match the proposal
`Task.startSynchronously` -> `Task.immediate`
`*TaskGroup.startTaskSynchronously{UnlessCancelled}` -> `*TaskGroup.addImmediateTask{UnlessCancelled}`
2025-05-09 23:59:30 -07:00
Slava Pestov
10ca7f6614 Merge pull request #81299 from slavapestov/remote-mirrors-meet-packs
RemoteInspection: Support for parameter packs
2025-05-09 22:28:31 -04:00
Doug Gregor
c16e93f2cd Merge pull request #81420 from DougGregor/se-0470-synthesized-conformances-main-actor
[SE-0470] Fix synthesized conformances with default main actor isolation
2025-05-09 19:12:58 -07:00
Doug Gregor
9d493db479 [SE-0470] Fix synthesized conformances with default main actor isolation
When defaulting to main-actor isolation, types that have synthesized
conformances (e.g., for Equatable, Hashable, Codable) were getting
nonisolated members by default. That would cause compiler errors
because the conformances themselves defaulted to main-actor isolation
when their types were.

Be careful to only mark these members as 'nonisolated' when it makes
sense, and leave them to get the isolation of their enclosing type
when the conformance might have isolation. This ensures that one can
use synthesis of these protocols along with default main-actor mode.

There is a one-off trick here to force the synthesized CodingKeys to
be nonisolated, because the CodingKey protocol requires Sendable.
We'll separately consider whether to generalize this rule.

More of rdar://150691429.
2025-05-09 14:35:56 -07:00
Artem Chikin
94898aabf5 [Dependency Scanning][C++Interop] Do not query 'CxxStdlib' Swift overlay for textual modules which were not built with c++interop
When we discover a textual module dependency which is a module which was not originally built from source using C++ interop (specifying '-formal-cxx-interoperability-mode=off'), avoid looking up the C++ standard library Swift overlay for it. This is required for the case of the 'Darwin' module, for example, which includes headers which map to C++ stdlib headers when the compiler is operating in C++ interop mode, but the C++ standard library Swift overlay module itself depends on 'Darwin', which results in a cycle. To resolve such situations, we can rely on the fact that Swift textual interfaces of modules which were not built with C++ interop must be able to build without importing the C++ standard library Swift overlay, so we avoid specifying it as a dependency for such modules.

The primary source module, as well as Swift textual module dependencies which *were* built with C++ interop will continue getting a direct depedency of the 'CxxStdlib' Swift module.

Resolves rdar://150222155
2025-05-09 13:00:14 -07:00
Hamish Knight
b53c411655 [Frontend] Avoid storing StringRef values in ModuleAliasMap
Previously we would insert StringRefs that reference the keys in the
map, but that breaks if the invocation ever gets copied. Switch to
`std::string`.

rdar://148130166
2025-05-09 19:49:50 +01:00
Slava Pestov
70b413dc56 RemoteInspection: Support for parameter packs 2025-05-09 14:49:37 -04:00
Augusto Noronha
8ea544879b Merge pull request #81385 from augusto2112/get-sig-bits-ret
[RemoteMirror] Remove accidental unconditional return
2025-05-09 11:36:38 -07:00
Mike Ash
161209f132 Merge pull request #81380 from mikeash/function-cast-ptrauth
[Concurrency] Use reinterpret_cast for function_cast when ptrauth is on.
2025-05-09 14:08:44 -04:00
Henrik G. Olsson
efd70b1f54 Prevent silgen for macro expansions with type errors (#81396)
Due to a bug in how macros on nodes imported from clang are evaluated,
their function body is not always type checked. This forces type
checking before silgen of a macro originating on a node imported from
clang, to prevent crashing in silgen.

rdar://150940383
2025-05-09 10:27:27 -07:00
eeckstein
3b6805a86f Merge pull request #81373 from eeckstein/fix-embedded-error
EmbeddedSwiftDiagnostics: fix and improve some embedded diagnostic errors
2025-05-09 07:04:19 +02:00
Alejandro Alonso
02d9779ba3 Merge pull request #81184 from Azoy/no-more-is-array-type
[AST] Rename isArrayType and split the InlineArray portion
2025-05-08 20:52:51 -07:00
Daniil Kovalev
a5c727125e Fix compilation errors appearing due to missing <cstdint> include (#81233)
This patch resolves the issue by adding missing `<cstdint>` includes.
For SmallVector.h, such a change was already introduced in LLVM repository:
7e44305041

<!--
If this pull request is targeting a release branch, please fill out the
following form:

https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1

Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:

  Resolves <link to issue>, resolves <link to another issue>.

For more information about linking a pull request to an issue, see:

https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->

<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:

https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci

Thank you for your contribution to Swift!
-->
2025-05-08 17:43:29 -07:00
Augusto Noronha
6a6b0ce80b [RemoteMirror] Remove accidental unconditional return 2025-05-08 15:15:43 -07:00
Mike Ash
0f2b047155 [Concurrency] Use reinterpret_cast for function_cast when ptrauth is on.
We need to use reinterpret_cast when ptrauth is enabled to ensure that any necessary auth-and-sign operations are performed.

rdar://150747009
2025-05-08 16:28:45 -04:00
Ben Barham
6667471b3d Merge pull request #81115 from beccadax/abi-let-you-graduate
Finish implementing `@abi` (SE-0476)
2025-05-08 12:52:00 -07:00
Meghana Gupta
1cdfd01575 Merge pull request #81362 from meg-gupta/enableassert
Remove disabled asserts in LifetimeDependence
2025-05-08 12:27:16 -07:00
Erik Eckstein
be322877b1 EmbeddedSwiftDiagnostics: improve error message for non-specialized generic function calls
Tell the user if the specialization isn't done because of a dynamic Self type.

rdar://150865684
2025-05-08 19:21:08 +02:00
Erik Eckstein
aacb4d458f Swift AST: add Type.hasDynamicSelf 2025-05-08 19:21:08 +02:00
Alejandro Alonso
bf8840bdfd Allow the mangler to disregard inverses 2025-05-08 10:17:59 -07:00
Artem Chikin
8cd193fc08 [Dependency Scanning] Remove 'ClangImporter' instance from dependency scanning worker
Move relevant logic directly into the worker
2025-05-07 16:43:45 -07:00
Alejandro Alonso
d26bde798e Start building the runtime demangle tree for extended existentials 2025-05-07 13:56:25 -07:00
Meghana Gupta
5f0d37ca30 Remove disabled asserts in LifetimeDependence 2025-05-07 12:10:18 -07:00
Nate Cook
e68069f891 [stdlib] Allow a default for optional interpolations (#80547)
This adds an `appendInterpolation` overload to
`DefaultStringInterpolation` that includes a parameter for providing a
default string when the value to interpolate is `nil`. This allows this
kind of usage:

```swift
let age: Int? = nil
print("Your age is \(age, default: "timeless")")
// Prints "Your age is timeless"
```

The change includes an additional fixit when optional values are
interpolated, with a suggestion to use this `default:` parameter.
2025-05-07 12:47:02 -05:00
Anthony Latsis
88de66523c Merge pull request #81280 from AnthonyLatsis/arachnocampa-luminosa
Frontend: Obsolete `-fixit-all` and `-emit-fixits-path`
2025-05-07 07:10:13 +01:00
Anthony Latsis
4f4141fea8 Frontend: Obsolete -fixit-all and -emit-fixits-path
With `ARCMigrate` and `arcmt-test` removed from clang in
https://github.com/llvm/llvm-project/pull/119269 and the new code
migration experience under way (see
https://github.com/swiftlang/swift-evolution/pull/2673), these options
are no longer relevant nor known to be in use. They were introduced
long ago to support fix-it application in Xcode.

For now, turn them into a no-op and emit a obsoletion warning.
2025-05-07 02:30:30 +01:00
Doug Gregor
aee6a52bcf Merge pull request #81296 from DougGregor/infer-nonisolated-conformances-from-witnesses
[SE-0470] Prohibit inference of isolated conformances with nonisolated witnesses
2025-05-06 16:02:36 -07:00
Artem Chikin
69f8a6fefa Merge pull request #81313 from artemcm/DepScanVariantError
[Dependency Scanning] Emit a detailed error diagnostic on Clang module variant discovery
2025-05-06 13:26:47 -07:00
eeckstein
84058a7fdc Merge pull request #81286 from eeckstein/temprvalue-opt
TempRValueElimination: re-implement the pass in swift
2025-05-06 19:37:40 +02:00
Artem Chikin
4b26a3d10a [Dependency Scanning] Emit a detailed error diagnostic on Clang module variant discovery
In expectation, this should never happen. Such a situation means that within the same scanning action, Clang Dependency Scanner has produced two different variants of the same module. This is not supposed to happen, but we are currently hunting down the rare cases where it does, seemingly due to differences in Clang Scanner direct by-name queries and transitive header lookup queries.
2025-05-06 08:55:57 -07:00
Michael Gottesman
b34e2d72fb Merge pull request #81306 from gottesmm/pr-b6ba1a771d90007a5ee6da3e4dc657bfef32b320
[swift-settings] Now that we aren't using it immediately, remove it from tree.
2025-05-06 08:21:23 -07:00
Slava Pestov
cc8639b523 Merge pull request #81301 from slavapestov/remote-mirrors-cleanups
RemoteInspection: Two small cleanups
2025-05-06 07:43:47 -04:00
Erik Eckstein
c6b1e3e854 TempRValueElimination: re-implement the pass in swift
Beside cleaning up the source code, the motivation for the translation into Swift is to make it easier to improve the pass for some InlineArray specific optimizations (though I'm not sure, yet if we really need those).
Also, the new implementation doesn't contain the optimize-store-into-temp optimization anymore, because this is covered by redundant load elimination.
2025-05-06 13:08:09 +02:00
Erik Eckstein
d2f8c0cf49 Swift SIL: add some Instruction APIs
* `OpenExistentialAddrInst.isImmutable`
* `YieldInst.convention`
* `CopyAddrInst.set(isTakeOfSource:)` and `CopyAddrInst.set(isInitializationOfDestination:)`
2025-05-06 12:35:21 +02:00
Allan Shortlidge
3323d6126f Merge pull request #81258 from tshortli/clang-importer-warning-group
ClangImporter: Introduce the `#ClangDeclarationImport` diagnostic group
2025-05-05 18:43:31 -07:00
Artem Chikin
cd4ff86f47 Merge pull request #81262 from artemcm/DepScanParallelDiagnosticConsumer
[Dependency Scanning] Always use a locking diagnostic consumer
2025-05-05 15:42:16 -07:00
Allan Shortlidge
24fa9c8703 ClangImporter: Introduce the #ClangDeclarationImport diagnostic group.
The warnings that ClangImporter emits about issues it encounters while
importing declarations from Clang modules should all belong to a diagnostic
group so that users of `-warnings-as-errors` can control their behavior using
the compiler flags introduce with SE-0443. It's especially important that these
diagnostics be controllable since they are often caused by external
dependencies and therefore the developer may not have any control over whether
they are emitted.

The `#ClangDeclarationImport` diagnostic group is intentionally broad so that
developers have a way to control all of these diagnostics with a single
`-Wwarning` flag. I fully expect that we'll introduce finer-grained diagnostic
groups for some of these diagnostics in the future, but those groups should be
hierarchically nested under `#ClangDeclarationImport`, which is supported by
SE-0443.

Resolves rdar://150524204.
2025-05-05 14:16:53 -07:00
Becca Royal-Gordon
01431b87b2 Make @abi non-experimental
This includes changing the feature name so that compilers with the experimental feature don’t accidentally pick up content that only works in the final version.

Resolves rdar://150065196.
2025-05-05 13:50:51 -07:00
Becca Royal-Gordon
0c508a8b78 Ban @abi on multi-var PBDs
Per a comment in the review thread that the comma in a multi-variable pattern binding makes it look like the `@abi` attribute has several arguments.
2025-05-05 13:50:17 -07:00