Commit Graph

4241 Commits

Author SHA1 Message Date
Cyndy Ishida
64168edbf5 [Modules] Allow implicit conversions when loading interfaces with invalid os versions (#82228)
Initially, the compiler rejected building dependencies that contained OS
versions in an invalid range. However, this happens to be quite
disruptive, so instead allow it and request that these versions be
implicitly bumped based on what `llvm::Triple::getCanonicalVersionForOS`
computes.

resolves: rdar://153205856
2025-06-16 12:46:32 -07:00
Anthony Latsis
106d5f4461 {AST,Basic}Bridging: Use SWIFT_COMPUTED_PROPERTY 2025-06-16 19:11:32 +01:00
Anthony Latsis
08d71a46eb Basic, SIL: Include <swift/bridging> when avaiable instead of defining our own macros 2025-06-13 23:13:26 +01:00
John Hui
44aba1382d [SourceKit] Support location info for macro-expanded Clang imports
Currently, when we jump-to-definition for decls that are macro-expanded
from Clang imported decls (e.g., safe overloads generated by
@_SwiftifyImport), setLocationInfo() emits a bongus location pointing to
a generated buffer, leading the IDE to try to jump to a file that does
not exist.

The root cause here is that setLocationInfo() calls getOriginalRange()
(earlier, getOriginalLocation()), which was not written to account for
such cases where a macro is generated from another generated buffer
whose kind is 'AttributeFromClang'.

This patch fixes setLocationInfo() with some refactoring:

-   getOriginalRange() is inlined into setLocationInfo(), so that the
    generated buffer-handling logic is localized to that function. This
    includes how it handles buffers generated for ReplacedFunctionBody.

-   getOriginalLocation() is used in a couple of other places that only
    care about macros expanded from the same buffer (so other generated
    buffers not not relevant). This "macro-chasing" logic is simplified
    and moved from ModuleDecl::getOriginalRange() to a free-standing
    function, getMacroUnexpandedRange() (there is no reason for it to be
    a method of ModuleDecl).

-   GeneratedSourceInfo now carries an extra ClangNode field, which is
    populated by getClangSwiftAttrSourceFile() when constructing
    a generated buffer for an 'AttributeFromClang'. This could probably
    be union'ed with one or more of the other fields in the future.

rdar://151020332
2025-06-12 18:22:06 -07:00
swift-ci
2e97515e4d Merge remote-tracking branch 'origin/main' into rebranch 2025-06-12 09:17:50 -07:00
Stephen Canon
9259c3eec4 Add new interleave and deinterleave builtins (#81689)
Ideally we'd be able to use the llvm interleave2 and deinterleave2
intrinsics instead of adding these, but deinterleave currently isn't
available from Swift, and even if you hack that in, the codegen from
LLVM is worse than what shufflevector produces for both x86 and arm. So
in the medium-term we'll use these builtins, and hope to remove them in
favor of [de]interleave2 at some future point.
2025-06-12 12:01:53 -04:00
swift-ci
18ead87198 Merge remote-tracking branch 'origin/main' into rebranch 2025-06-09 19:04:07 -07:00
Meghana Gupta
dcf072f9d0 Introduce a new suppressible experimental feature to guard @_lifetime 2025-06-07 12:49:07 -07:00
swift-ci
63d3423f8f Merge remote-tracking branch 'origin/main' into rebranch 2025-06-06 15:21:33 -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
swift-ci
6c8e39abdb Merge remote-tracking branch 'origin/main' into rebranch 2025-06-06 12:13:31 -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
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
swift-ci
c99747e0c1 Merge remote-tracking branch 'origin/main' into rebranch 2025-06-02 23:38:09 -07:00
Artem Chikin
4fb4945ab9 Merge pull request #81908 from artemcm/FixImplicitBuildCXXInteropCycle
[C++Interop] Do not query C++ Standard Library Swift overlays when building Swift modules which were built without C++ interop
2025-06-02 23:26:27 -07:00
Artem Chikin
5b501ad2c5 Hard-code the 'Darwin' module as having been built without C++ interop
Textual interfaces for 'Darwin' built with recent compilers specify that it is built witout C++ interop enabled. However, to ensure compatibility with versions of the 'Darwin' module built with older compilers, we hard-code this fact. This is required to break the module cycle that occurs when building the 'Darwin' module with C++ interop enabled, where the underlying 'Darwin' clang module depends on C++ standard library for which the compiler brings in the 'CxxStdlib' Swift overlay, which depends on 'Darwin'.
2025-06-02 14:16:57 -07:00
swift-ci
f6526c0013 Merge remote-tracking branch 'origin/main' into rebranch 2025-06-02 10:00:43 -07:00
Pavel Yaskevich
e1e9f04398 Merge pull request #81863 from xedin/using-for-default-isolation-in-file-context
[AST/Sema] SE-0478:  Implement `using` declaration under an experimental flag
2025-06-02 09:56:29 -07:00
swift-ci
919dbfdff0 Merge remote-tracking branch 'origin/main' into rebranch 2025-06-01 08:53:21 -07:00
Allan Shortlidge
d5ef256b40 Merge pull request #81751 from tshortli/migratable-member-import-visibility 2025-06-01 08:49:01 -07:00
Pavel Yaskevich
c246a7a372 [AST/Sema] Hide using declaration behind DefaultIsolationPerFile experimental feature 2025-05-31 10:49:50 -07:00
swift-ci
781cb5de48 Merge remote-tracking branch 'origin/main' into rebranch 2025-05-31 02:14:22 -07:00
Hamish Knight
dde37c0f01 Merge pull request #81868 from hamishknight/x-of-hearts
Change InlineArray sugar separator `x` -> `of`
2025-05-31 10:05:26 +01:00
Allan Shortlidge
aca604660f AST/Sema: Make MemberImportVisibility a migratable feature.
The migration to `MemberImportVisibility` can be performed mechanically by
adding missing import declarations, so offer automatic migration for the
feature.

Resolves rdar://151931597.
2025-05-30 15:34:08 -07:00
swift-ci
e79cecfe96 Merge remote-tracking branch 'origin/main' into rebranch 2025-05-30 09:55:35 -07:00
Ben Barham
b0d5e0e8f1 Merge pull request #81697 from bnbarham/use-toolchain-version
Add the distribution tag to `-print-target-info`
2025-05-30 09:51:03 -07:00
Hamish Knight
5d1f219acb Change InlineArray sugar separator x -> of 2025-05-30 13:50:22 +01:00
Ben Barham
3c098782b4 Add the distribution tag to -print-target-info
Ideally this would also update the `--version` output to be overridden
by `SWIFT_TOOLCHAIN_VERSION`, but unfortunately various tools rely on
the current format (eg. swift-build).
2025-05-28 17:29:17 -07:00
swift-ci
e33c562009 Merge remote-tracking branch 'origin/main' into rebranch 2025-05-22 08:53:45 -07:00
Doug Gregor
abad2fae0f Make the optional feature StrictMemorySafety migratable
This feature is essentially self-migrating, but fit it into the
migration flow by marking it as migratable, adding
`-strict-memory-safety:migrate`, and introducing a test.
2025-05-22 11:07:13 +01:00
Doug Gregor
a32782bcbc Make InferIsolatedConformances a migratable upcoming feature
When migrating, provide warnings that add 'nonisolated' to nonisolated
conformances that don't already have it and would end up being inferred
to be isolated under the upcoming feature.
2025-05-22 11:07:13 +01:00
swift-ci
1be25bb35f Merge remote-tracking branch 'origin/main' into rebranch 2025-05-21 13:51:40 -07:00
Artem Chikin
24f2975db6 Merge pull request #81510 from artemcm/ConstSyntacticVerify
[Compile Time Values] Add syntactic verification of valid expressions in `@const` contexts
2025-05-21 13:22:05 -07:00
swift-ci
8ec33f9344 Merge remote-tracking branch 'origin/main' into rebranch 2025-05-20 10:39:13 -07:00
Stephen Canon
3aa7b592b6 Implement Builtin.select binding llvm select instruction (#81598)
Not used (yet), but needed to implement SIMD.replacing(with:where:) idiomatically, and probably useful otherwise.
2025-05-20 13:30:59 -04:00
Artem Chikin
d8176a7e89 [Compile Time Values] Add syntactic verification of valid expressions in '@const' contexts
Syntactically verify that initializer expressions of '@const' variables and argument expressions to '@const' parameters consist strictly of syntactically-verifiable set of basic values and operations
2025-05-20 09:38:36 -07:00
swift-ci
fe523c4b0b Merge remote-tracking branch 'origin/main' into rebranch 2025-05-20 02:15:11 -07:00
Hamish Knight
d672f750e7 [Basic] Rename abortWithPrettyStackTraceMessage to ABORT
Turn it into a wrapping macro that includes the file location, and
move into `Assertions.h`.
2025-05-19 20:55:01 +01:00
Hamish Knight
ffb474e0b9 [Basic] NFC: Factor out _FILENAME_FOR_ASSERT macro 2025-05-19 20:55:01 +01:00
Hamish Knight
92641253f7 [Basic] NFC: Remove ASSERT_help from header
It's not clear this is a useful utility to expose since it will only
print the message once.
2025-05-19 20:55:01 +01:00
Hamish Knight
d46aec9f00 [Basic] Handle multiline strings in abortWithPrettyStackTraceMessage
Improve the formatting by indenting to match the rest of the
pretty stack trace.
2025-05-19 20:55:01 +01:00
swift-ci
3d8feb9841 Merge remote-tracking branch 'origin/main' into rebranch 2025-05-16 03:17:21 -07:00
Erik Eckstein
7f6fb74418 SILBridging: move BridgedInstruction.OptionalInt -> BridgedOptionalInt in BasicBridging.h 2025-05-15 21:29:02 +02:00
swift-ci
a9c3de06ca Merge remote-tracking branch 'origin/main' into rebranch 2025-05-15 08:33:46 -07:00
swift-ci
33ad7cd97b Merge remote-tracking branch 'origin/main' into rebranch 2025-05-15 05:54:06 -07:00
Anthony Latsis
fe575c66a9 Manually merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
lib/AST/RequirementMachine/RequirementLowering.cpp
2025-05-15 13:48:37 +01:00
Pavel Yaskevich
c050e8f75a [AST] Protect declarations with @_inheritActorContext(always) by a feature flag
This is going to avoid condfails when declarations are printed
in the swiftinterface files.
2025-05-14 20:07:59 -07:00
Becca Royal-Gordon
36de3a85e9 Merge pull request #81459 from beccadax/mod-squad-serialize 2025-05-14 19:25:22 -07:00
Becca Royal-Gordon
c3a61bee0e Add experimental feature for module selector 2025-05-14 11:16:02 -07:00
Steven Wu
3c81c1ca9f [Caching] Remove CASFS clang module implemenation
Remove the CASFS based clang module implemenation as it is not longer
used.
2025-05-14 09:35:03 -07:00