Commit Graph

47819 Commits

Author SHA1 Message Date
Arnold Schwaighofer
17447a3378 Merge pull request #85551 from aschwaighofer/wip_embedded_exit
Preliminary support for existential in embedded Swift
2025-11-18 15:10:40 -05:00
Egor Zhdan
4234fb7358 Merge pull request #85340 from egorzhdan/egorzhdan/revert-cs-std-string
Revert "[ConstraintSystem] C++ Interop: Binding a string literal to `std.string` shouldn't increase the score"
2025-11-18 18:51:12 +00:00
Steven Wu
e519e59acc Merge pull request #85547 from cachemeifyoucan/eng/PR-164903080
Revert "[Caching][NFC] Using llvm::cas::CASConfiguration"
2025-11-18 09:43:41 -08:00
Steven Wu
b56f541732 Merge pull request #85499 from cachemeifyoucan/eng/PR-164409895
[Caching] Fix multi-threaded WMO with MCCAS
2025-11-18 09:22:13 -08:00
Adrian Prantl
5c3a26633a Merge pull request #85519 from adrian-prantl/unregister-api
[LLDB] Add an API for unregistering MemoryBuffer modules (NFC)
2025-11-18 08:27:05 -08:00
Anthony Latsis
e62153187a Merge pull request #85487 from swiftlang/jepa-main4
AST: Properly disallow isa/cast/dyn_cast on `Type`
2025-11-18 07:35:46 +00:00
Kuba (Brecka) Mracek
5f578adb3d Merge pull request #85530 from kubamracek/section-closures
SE-0492: Add support for closures (with no captures) into @section expressions
2025-11-17 19:29:49 -08:00
Arnold Schwaighofer
a725de5ba6 Address review comments 2025-11-17 15:52:00 -08:00
Michael Gottesman
27dc291c88 Merge pull request #85520 from gottesmm/pr-3347fe62df76bb72f5f1bb27d446618b521580db
[irgen] Make AsyncLetBegin and AsyncLetFinish UNKNOWN_MEMEFFECTS instead of ArgMemOnly.
2025-11-17 15:47:43 -08:00
Slava Pestov
61e418c3e7 Merge pull request #85513 from slavapestov/refactor-csbindings
Refactor BindingSet a little bit
2025-11-17 17:52:16 -05:00
Arnold Schwaighofer
62ac48a17e Complete support for outline existential storage
... or so I believe
2025-11-17 12:48:45 -08:00
Arnold Schwaighofer
f38ad4b09f Start support for protocol witness tables 2025-11-17 12:46:35 -08:00
Arnold Schwaighofer
4285a2169d IRGen: Start support for embedded existentials
Allow storing struct, enum, and tuple types in an any.
2025-11-17 12:46:35 -08:00
Steven Wu
8e68fab034 Revert "[Caching][NFC] Using llvm::cas::CASConfiguration"
This reverts commit 4f059033bb. The change
is actually not NFC since previously, there is a cache in the
CompilerInvocation that prevents the same CAS from the same CASOptions
from being initialized multiple times, which was relied upon when
running inside sub invocation. When switching to a non-caching simple
CASOption types, it causes every single sub instance will create its own
CAS, and it can consume too many file descriptors and causing errors
during dependency scanning.

rdar://164903080
2025-11-17 12:21:53 -08:00
Slava Pestov
ce3b5eb8ae Sema: Bring back BindingSet::operator bool but call it BindingSet::isViable() 2025-11-17 11:16:37 -05:00
Slava Pestov
c0238dbb4c Sema: Split up BindingSet::inferTransitiveBindings() into three methods 2025-11-17 11:16:37 -05:00
Slava Pestov
ab72c53103 Sema: Split off inferTransitiveKeyPathBindings() from BindingSet::inferTransitiveBindings() 2025-11-17 11:16:36 -05:00
Slava Pestov
45d03e152c Sema: Split up BindingSet::finalize() into finalizeKeyPathBindings() and finalizeUnresolvedMemberChain() 2025-11-17 11:16:33 -05:00
Slava Pestov
02129f2b1f Sema: Pull call to inferTransitiveBindings() out of BindingSet::finalize() 2025-11-17 11:16:32 -05:00
Slava Pestov
5f2db0c96c Sema: Pull call to determineLiteralCoverage() out of BindingSet::finalize() 2025-11-17 11:15:52 -05:00
Hamish Knight
1f32f7f5ac Merge pull request #85525 from hamishknight/yeet
[CS] Remove `getImplicitValueConversionLocator` & `ImplicitConversion`
2025-11-17 14:03:13 +00:00
Hamish Knight
9a31ef029c [CS] NFC: Remove CTP_ComposedPropertyWrapper
This has been unused since we added a custom `AllowWrappedValueMismatch`
fix.
2025-11-16 18:31:55 +00:00
Hamish Knight
6abfea9312 [CS] NFC: Remove CTP_CalleeResult
This has been unused since the removal of CSDiag.
2025-11-16 18:29:37 +00:00
Kuba Mracek
8da5f3141e SE-0492: Add support for closures (with no captures) into @section expressions 2025-11-16 09:21:12 -08:00
Hamish Knight
6dfff1ce9c [CS] Remove getImplicitValueConversionLocator & ImplicitConversion
These are now unused.
2025-11-15 19:26:46 +00:00
Michael Gottesman
01c2e0fde9 [irgen] Make AsyncLetBegin and AsyncLetFinish UNKNOWN_MEMEFFECTS instead of ArgMemOnly.
In a discussion with @rjmccall, we agreed that these should really be
UNKNOWN_MEMEFFECTS so we are conservative.

Just slicing this off from a larger patch stream.
2025-11-14 15:08:41 -08:00
Adrian Prantl
addff767a6 [LLDB] Add an API for unregistering MemoryBuffer modules (NFC) 2025-11-14 13:51:30 -08:00
Anthony Latsis
dd5ac838e5 AST: Properly disallow isa/cast/dyn_cast on Type
We currently disallow these by deleting them in the `swift` namespace.
This approach has several loopholes, all of which ultimately work
because we happen to define specializations of `simplify_type` for
`swift::Type`:
* `llvm::isa/cast/dyn_cast`. The deleted partial specializations will
  not be selected because they are not defined in the `llvm` namespace.
* The argument is a non-const `Type`. The deleted function templates
  will not be selected because they all accept a `const Type &`, and
  there is a better `Y &Val` partial specialization in LLVM.
* Other casting function templates such as `isa_and_nonull` and
  `cast_if_present` are not deleted.

Eliminate these loopholes by instead triggering a static assertion
failure with a helpful message upon instantiation of `CastInfo` for
`swift::Type`.
2025-11-14 19:02:41 +00:00
Slava Pestov
23a7ca04bf Sema: Remove BindingSet::operator bool 2025-11-14 10:05:32 -05:00
Ian Anderson
7e95f8b614 Merge pull request #85470 from ian-twilightcoder/swift-api-digester-remove-iframework
[ABIChecker] Remove -iframework from swift-api-digester
2025-11-14 01:40:36 -08:00
Steven Wu
b1d669bea1 [Caching] Fix multi-threaded WMO with MCCAS
MCCAS wasn't setup correctly when using parallel WMO. Make sure the
CAS ObjectStore and ResultCallbacks are passed to LLVM backend when
using parallel WMO.

rdar://164409895
2025-11-13 12:20:31 -08:00
Henrik G. Olsson
54cfd7a1c3 Merge pull request #85354 from hnrklssn/verify-expansion-content
[macros] add -Rmacro-expansions
2025-11-13 11:56:41 -08:00
Alexis Laferrière
3545603e1c Merge pull request #77737 from xymus/restrict-spi-operators
Sema: Restrict use of SPI operators to files importing the corresponding SPI group
2025-11-13 09:57:10 -08:00
Daniel Rodríguez Troitiño
21ccb27768 [ClangImporter] Undo changes around createClangInvocation (followup to #85445) (#85457)
Feedback in #85445 after it merged pointed out that the changes around
`createClangInvocation` are not necessary because `CompilerInvocation`
do not hold a reference to `clang::DiagnosticOptions`, only the
`clang::driver::Driver` does.

These changes undo the modifications done there and return the code to
the previous state (but keeps the changes around `createClangDriver`
which was causing the use-after-free).
2025-11-13 08:01:37 -08:00
Adrian Prantl
3f9f797c69 Merge pull request #85466 from adrian-prantl/remove-temp-api
Remove unused ASTSectionImporter entry point (NFC)
2025-11-13 00:35:39 -08:00
Slava Pestov
e8004b73d9 Merge pull request #85459 from slavapestov/rename-generic-environment-operations
AST: Rename mapTypeIntoContext() => mapTypeIntoEnvironment(), mapTypeOutOfContext() => mapTypeOutOfEnvironment()
2025-11-13 02:51:17 -05:00
Hiroshi Yamauchi
a96b57de17 Fix direct clang cc1 emit-pcm commands with vfs overlay on Windows (#85325)
Explicit module builds currently fail on Windows because
direct-clang-cc1-module-build emit-pcm commands take overlaid system
module map files as inputs but miss the clang VFS overlay. This change
adds the overlay and fixes explicit module builds on Windows.
2025-11-12 21:03:15 -08:00
Ian Anderson
5cdf2a879a [ABIChecker] Remove -iframework from swift-api-digester
-iframework is a holdover from when swift-api-digester was an LLVM tool. Now that everything has switched over to -Fsystem, -iframework can be removed.

rdar://153665579
2025-11-12 16:37:49 -08:00
Adrian Prantl
96e04bfa1a Remove unused ASTSectionImporter entry point (NFC)
This was introduced as a temporary measure in https://github.com/swiftlang/swift/pull/67833
2025-11-12 14:54:19 -08:00
Sam Pyankov
809f72fde6 Merge pull request #85394 from sepy97/register-module-dependency
Add new flag to enable dependency scanning without importing in the frontend
2025-11-12 14:52:59 -08:00
Slava Pestov
64f2d1acce AST: Rename mapConformanceOutOfContext() => mapConformanceOutOfEnvironment(), mapReplacementTypesOutOfContext() => subs.mapReplacementTypesOutOfEnvironment() 2025-11-12 14:48:19 -05:00
Slava Pestov
819738c83e AST: Rename mapTypeIntoContext() => mapTypeIntoEnvironment(), mapTypeOutOfContext() => mapTypeOutOfEnvironment() 2025-11-12 14:48:19 -05:00
Alexis Laferrière
a4865be7e3 Sema: Gate SPI operator fix behind EnforceSPIOperatorGroup
This new check is source breaking. Let's gate it behind an opt-in flag
for now and enable it by default on a new language mode or similar.
2025-11-12 10:46:21 -08:00
Alexis Laferrière
937e6c5241 Merge pull request #85446 from xymus/serial-xref-check
Serialization: Error on leaked cross-references to `@_implementationOnly` dependencies
2025-11-12 10:42:58 -08:00
Alexis Laferrière
dc7f30fac9 Merge pull request #85387 from xymus/exportability-nle-proto
Sema: Exportability check protocols in non-library-evolution mode
2025-11-12 10:04:04 -08:00
Pavel Yaskevich
30b207ecf4 Merge pull request #85418 from xedin/rdar-164267736
[AST/Serialization] A few fixes for `nonisolated(nonsending)` handling
2025-11-12 09:34:49 -08:00
Daniel Rodríguez Troitiño
9eca612b86 [ClangImporter] Avoid use-after-free of clang::DiagnosticOptions after rebranch (#85445)
Upstream LLVM in llvm/llvm-project#139584 changed `DiagnosticOptions`
from being a referenced counted object to just be a reference, not owned
by the `clang::DiagnosticEngine`.

In 0981b71090 (part of #82243), the usages
of the Swift repository were adapted to the new memory model, but it
introduced at least one use-after-free and a potential one around the
usage of Clang in the Clang Importer.

This commit tries to fix the use-after-free in both cases, by returning
a `unique_ptr` to the `clang::DiagnosticOptions`, which makes the
lifetime of the `DiagnosticOptions` match the lifetime of the variable
that uses it (normally a `CompilerInvocation`).

Other cases in 0981b71090 should be safe
because the lifetime of the `DiagnosticOptions` do not seem to propagate
beyond the scope of the functions where they live (but I am not fully
sure about the one in `IDETool/CompilerInvocation.cpp` completely).

This was causing compiler crashes during the test
`Interop/Cxx/stdlib/unsupported-stdlib.swift` which eventually uses
`createClangDriver` and tries to emit a diagnostic, which in some cases
was reading the memory from `DiagnosticOptions` when it was already out
of scope.
2025-11-12 08:38:36 -08:00
Andrew Trick
b28cd59dfc [NFC] TypeLowering: add CustomDeinit.
Teach SIL type lowering to recursively track custom vs. default deinit status.

Determine whether each type recursively only has default deinitialization. This
includes any recursive deinitializers that may be invoked by releasing a
reference held by this type.

If a type only has default deinitialization, then the deinitializer cannot
have any semantically-visible side effects. It cannot write to any memory
2025-11-11 17:29:45 -08:00
Pavel Yaskevich
47805810be [AST/Serialization] Remove isCallerIsolated bit from ParamDecl
This was used primarily by the printer and doesn't work when
`nonisolated(nonsending)` is inferred, so let's remove it.
2025-11-11 16:07:19 -08:00
John Hui
d5b3079567 Merge pull request #85379 from j-hui/dont-import-template-type-arguments-round-2
[cxx-interop] Make ClangDeclExplicitSafety request non-recursive
[cxx-interop] Do not import template type arguments
[cxx-interop] Check template argument safety in ClangDeclExplicitSafety
2025-11-11 13:44:07 -08:00