Commit Graph

194977 Commits

Author SHA1 Message Date
Anton Korobeynikov
28dadc42c7 Add x86_64 API differences due to coroutine changes 2025-11-13 12:34:16 -08:00
Anton Korobeynikov
15a8d11974 Add typecheck tests for @yield_once / @yields 2025-11-13 12:34:16 -08:00
Anton Korobeynikov
f2f1ae972e Outline stdlib ABI changes wrt coroutines 2025-11-13 12:34:16 -08:00
Anton Korobeynikov
4eb5d62df6 Unbreak tests after read / modify accessors added 2025-11-13 12:34:16 -08:00
Anton Korobeynikov
0b345097e0 Deconstruct Escapable check for coroutines with normal results 2025-11-13 12:34:16 -08:00
Anton Korobeynikov
263f6e3dd6 Few fixes related to coroutine function types. 2025-11-12 21:02:55 -08:00
Anton Korobeynikov
366b552286 Properly substitute coroutines 2025-11-12 21:02:55 -08:00
Anton Korobeynikov
6c504bb9fa Add parsing of @yield_once and @yields attributes and corresponding type checks 2025-11-12 21:02:55 -08:00
Anton Korobeynikov
76c9a23f27 First cut of making coroutine AST type 2025-11-12 21:02:53 -08:00
Anton Korobeynikov
797f500286 Add basic boilerplate for AST coroutines and yields 2025-11-12 21:02:25 -08:00
Egor Zhdan
2db0e8aea8 Merge pull request #85439 from egorzhdan/egorzhdan/endif-objc
[cxx-interop] Emit `#endif // defined(__OBJC__)` with the comment consistently
2025-11-13 03:59:17 +00:00
Saleem Abdulrasool
121c75989c Merge pull request #85465 from speednoisemovement/shorten_arm
build.ps1: fix toolchain name trimming for arm64
2025-11-12 18:28:03 -08:00
Pavel Yaskevich
4bd370fe46 Merge pull request #85451 from xedin/rdar-164201746
[CSOptimizer] Skip `??` if it's involved in optional chain with unres…
2025-11-12 17:30:51 -08:00
Doug Gregor
669f6dc83f Merge pull request #85463 from DougGregor/autolink-multithreaded-ir
[Multi-threaded IRGen] Ensure that autolink info gets into each object file
2025-11-12 16:43:37 -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
c3e07c63ee Merge pull request #85452 from slavapestov/fix-memory-usage-stat
Basic: Use getrusage() to read memory usage
2025-11-12 17:27:18 -05:00
Leonard Grey
c7d25318c6 build.ps1: fix toolchain name trimming for arm64 2025-11-12 16:27:48 -05:00
Doug Gregor
cc78bb5ebf [Multi-threaded IRGen] Ensure that autolink info gets into each object file
When performing multi-threaded IRGen, all of the link libraries used
for autolinking went (only) into the first object file. If the object
files were then placed in a static archive, the autolinking would only
kick in if clients that link the static library reference something in
the first object file. This causes link failures.

Make sure that we put the autolink information into each of the object
files we create when doing multi-threaded IRGen.

Fixes the rest of rdar://162400654.
2025-11-12 11:37:19 -08:00
Hamish Knight
e2287b6312 Merge pull request #85449 from hamishknight/whats-the-catch
[Sema] Skip type-checking catch bodies when computing the bound error type
2025-11-12 19:34:45 +00:00
Kavon Farvardin
47a6f2acfd Merge pull request #85392 from kavon/borrow-expr-implicit-infra
SILGen: add RValue emission for BorrowExpr
2025-11-12 11:23:52 -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
4d8d719b92 Merge pull request #85406 from naveen-seth/fix-ambiguous-trailing-closure-init
[Sema] Fix crash when diagnosing ambiguous trailing closure inits
2025-11-12 10:03:46 -08:00
Henrik G. Olsson
65d5425955 Merge pull request #85400 from hnrklssn/update-verify-tests-litplugin
[utils] integrate update-verify-tests with lit's --update-tests
2025-11-12 18:03:33 +00:00
Henrik G. Olsson
8631a89e59 Merge pull request #85399 from hnrklssn/update-verify-tests-remarks
[utils] add support for remarks to update-verify-tests, fix minor bugs
2025-11-12 18:01:07 +00: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
Michael Gottesman
e360e8cdfc Merge pull request #85454 from al45tair/fix-windows-pr-testing-2025-11-12
[Observation] Add missing dependencies.
2025-11-12 09:11:40 -08:00
Alastair Houghton
8172fde478 [Observation] We should be importing Android, not Bionic.
Apparently the right module is `Android`, not `Bionic`.  The latter
is the Clang module, with no Swift overlay.
2025-11-12 16:54:10 +00:00
Mishal Shah
fe97b6d055 Fix notification username in Branches.md 2025-11-12 08:41:24 -08:00
Mishal Shah
c345a31182 Update notification instructions in Branches.md
Clarified notification instructions for pull requests.
2025-11-12 08:41:01 -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
Alastair Houghton
052a1ae2fe [Observation] Add missing dependencies.
There should be additional dependencies listed for Observation,
as it's importing various platform modules.
2025-11-12 13:06:52 +00:00
Egor Zhdan
8cafef09c3 [cxx-interop] Emit #endif // defined(__OBJC__) with the comment consistently
This makes sure that whenever we emit `#if defined(__OBJC__)`, the matching `#endif` has a comment `// defined(__OBJC__)`.

This makes both testing and reading the header file easier.
2025-11-12 11:51:10 +00:00
Andrew Trick
09c828cbcb Merge pull request #81784 from atrick/typelower-customdeinit
TypeLowering: add Type.hasCustomDeinit
2025-11-12 02:42:39 -08:00
Jonathan Grynspan
276706eceb Don't abort on Linux if withLockIfAvailable() is called recursively. (#85448)
On all platforms except Linux, calling `withLockIfAvailable()`
recursively just returns `nil`. However, our Linux implementation
chooses to abort the process instead. We don't need this
inconsistent/destructive behaviour and can just return `nil` as we do
elsewhere.
2025-11-11 23:34:12 -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
Slava Pestov
9ac70ce728 Basic: Use getrusage() to read memory usage
On macOS 26, malloc_zone_statistics() always returns
a malloc_statistics_t with the max_size_in_use field
set to zero. This was an intentional change, so let's
remove calls to this API.

Instead, use the proc_pid_rusage() API and return the
ri_lifetime_max_phys_footprint field of rusage_info_v4.

Finally, remove the llvm::sys::Process::GetMallocUsage()
call on other platforms altogether. It returns the
current value and not the max value, so its misleading.
2025-11-11 20:02:20 -05:00
finagolfin
b57012039b [Test] Mark new test as executable_test (#85443)
Otherwise, various [non-executable CI like Android
fail](https://ci.swift.org/job/oss-swift-package-swift-sdk-for-android/75/console).
2025-11-11 17:00:03 -08:00
Henrik G. Olsson
5db7926e09 [utils] add support for expected-remarks to update-verify-tests.py 2025-11-11 16:35:00 -08:00
Henrik G. Olsson
c246140d7f [utils] remove trailing whitespace after removing diag 2025-11-11 16:34:59 -08:00
Henrik G. Olsson
4d5844b723 [utils] only steal 1 diagnostic
This fixes a bug in the diagnostic stealing logic when multiple
diagnostics target the same line, which would trigger an assert.
2025-11-11 16:34:59 -08:00
Henrik G. Olsson
4af20b25d5 [utils] fix bug in diagnostic stealing logic
When replacing expected diagnostic content, we should consider
expected diagnostics targeting the same target, not targeting the line
the expected diagnostic is on.
2025-11-11 16:34:55 -08:00
Henrik G. Olsson
38620d49b1 [utils] integrate update-verify-tests with lit's --update-tests
This adds a lit plugin wrapping the core of update-verify-tests. When
lit is invoked with --update-tests it will call the plugin, which checks
if the failure is due to a -verify mismatch. If it is, it tries to
repair the test. If the source file was originally created by
split-file, the changes are propagated to the parent file.

No tests are added, because I don't want to run nested llvm-lit tests
in Swift's test suite, but the core functionality is tested through
update-verify-tests.py.
2025-11-11 16:33:43 -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
Ben Barham
3eb1beaecf Merge pull request #83993 from bnbarham/switch-foundation-configuration
Switch Windows foundation tests back to debug for PR testing
2025-11-12 10:04:25 +10:00
Henrik G. Olsson
32fd1c0dda Merge pull request #85390 from hnrklssn/update-verify-tests-continuted
[utils] add support for expected-expansion to update-verify-tests
2025-11-11 23:24:55 +00:00
Pavel Yaskevich
a01692ace1 [CSOptimizer] Skip ?? if it's involved in optional chain with unresolved result type
`??` operator is overloaded on optionality of its result. When the
first argument matches exactly, the ranking is going to be skewed
towards selecting an overload choice that returns a non-optional type.
This is not always correct i.e. when operator is involved in optional
chaining. To avoid producing an incorrect favoring, let's skip the this
disjunction when constraints associated with result type indicate
that it should be optional.

Simply adding it as a binding won't work because if the second argument
is non-optional the overload that returns `T?` would still have a lower
score.

Resolves: rdar://164201746
2025-11-11 15:21:33 -08:00
Hamish Knight
14608cb059 [Sema] Skip type-checking catch bodies when computing the bound error type
Make sure we only ever type-check the `do` body of a `do-catch`
statement when lazily type-checking the bound error type, which we can
do for completion.

rdar://164481242
2025-11-11 23:04:30 +00:00
Hamish Knight
8b0853d92c [Sema] Assert that we don't re-type-check conditions
Sink the assertion down into `TypeChecker::typeCheckCondition` and
remove the old logic.
2025-11-11 23:04:30 +00: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