Commit Graph

194988 Commits

Author SHA1 Message Date
Jonathan Grynspan
09887f16c8 Adjust the docs for Mutex.withLockIfAvailable() re: spurious failures.
This PR adjusts the documentation for `Mutex.withLockIfAvailable()` to clarify
that it is not subject to spurious failures. The C11 and C++11 specs for their
respective `tryLock()` APIs allow for spurious failures, but our implementations
and those of every other similar API I've found don't use weak `cmpxchg`s and
don't spuriously fail.
2025-11-13 14:04:44 -05: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
Evan Wilde
4356019433 Merge pull request #85471 from etcwilde/ewilde/stringprocessing-default-hidden
CMake: StringProcessing: Set C visibility hidden
2025-11-13 09:19:02 -08:00
Mishal Shah
0e6c6bcfc1 Merge pull request #85478 from swiftlang/swift-6.3-scheme-on-main
[update-checkout] Add support for the swift 6.3 branches
2025-11-13 08:14:16 -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
Pavel Yaskevich
80e6cbf3ef Merge pull request #85460 from xedin/replace-checkconformancewithoutcontext-with-conformstoknownprotocol
[CSOptimizer] Use `conformsToKnownProtocol` to check whether paramete…
2025-11-13 07:40:36 -08:00
Charles Zablit
bf26dbfd1c Merge pull request #83488 from charles-zablit/charles-zablit/windows/upgrade-python-to-3.10 2025-11-13 12:38:08 +01: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
Mishal Shah
d30c1c9faf [update-checkout] Add support for the swift 6.3 branches 2025-11-12 22:23:20 -08: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
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
Evan Wilde
22d2511477 CMake: StringProcessing: Set C visibility hidden
Don't expose the C symbols from StringProcessing.
2025-11-12 17:03:14 -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
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
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
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
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
Pavel Yaskevich
62a917800d [CSOptimizer] Use conformsToKnownProtocol to check whether parameter conforms to ExpressibleBy{Array, Dictionary}Literal
The existing check is no-op because it would never produce a null for
`paramType` under the conditions in `else` branch. A better
API it use here is `conformsToKnownProtocol` just like in other cases.
2025-11-12 10:51:54 -08: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
b248d2d9b4 Sema: Restrict use of SPI operators to files importing the SPI group
Ensure that calls to SPI operators are only accepted in source files
importing the corresponding SPI group. This applies the same logic to
operators as we do for functions.

rdar://137713966
2025-11-12 10:45:41 -08:00
Alexis Laferrière
8e7fdb2559 Sema: Test that we can't use SPI operators in inlinable code 2025-11-12 10:45:41 -08:00
Alexis Laferrière
879f37c699 Sema: Test that SPI operators are only printed in the public swiftinterface
This was already working as expected. Adding a test to ensure it doesn't
regress.
2025-11-12 10:45:40 -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