Commit Graph

4313 Commits

Author SHA1 Message Date
Kavon Farvardin
5e9fba115a NFC: provide deprecation & unavailable attribute macros 2025-11-19 17:32:19 -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
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
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
06db612d79 Sema: Intro the CheckImplementationOnlyStrict feature 2025-11-11 10:26:00 -08:00
Arnold Schwaighofer
fe90be09e3 SE-0496 @inline(always) attribute was accepted
Enable it per default
2025-11-07 09:44:16 -08:00
Slava Pestov
b7a07db42d Merge pull request #84993 from slavapestov/enable-prepared-overloads
Sema: Enable prepared overloads by default
2025-11-06 14:04:13 -05:00
Pavel Yaskevich
e39a31a05f Merge pull request #85319 from xedin/rdar-162394810
[AST/Sema] Add a diagnostic group `ExplicitSendable` to replace `-require-explicit-sendable`
2025-11-06 06:48:50 -08:00
Henrik G. Olsson
040c9e6729 [macros] add -Rmacro-expansions
This adds the -Rmacro-expansions flag. It provides similar functionality
to -dump-macro-expansions, but instead of dumping the macro expansion to
stderr, it emits it line by line as remarks. This is useful for testing
with -verify, where both macro expansion content and warnings need to be
tested at the same time.
2025-11-05 18:45:34 -08:00
John Hui
eedefc5d57 [NFC] Delete unused feature SuppressCXXForeignReferenceTypeInitializers (#85301) 2025-11-05 17:12:09 -08:00
Pavel Yaskevich
123198b4ac [Frontend] Change -require-explicit-sendable argument to mean -Wwarning ExplicitSendable 2025-11-04 17:53:38 -08:00
Alexis Laferrière
62ee4486d7 Features: Intro CheckImplementationOnly 2025-11-04 13:50:25 -08:00
Becca Royal-Gordon
2504beeccc Merge pull request #85043 from beccadax/mod-squad-interface
[SE-0491] Conditionally emit module selectors into swiftinterfaces
2025-11-03 19:08:09 -08:00
Allan Shortlidge
1bf2e8ffb6 Merge pull request #85256 from tshortli/any-apple-os-availability
AST: Introduce experimental support for an `anyAppleOS` availability domain
2025-11-01 11:10:09 -07:00
Artem Chikin
164d3ae5a8 Merge pull request #85010 from artemcm/AlwaysRebuildExplicitInterface
[Explicit Module Builds] Always rebuild the target module in explicit `-compile-module-from-interface` builds.
2025-10-31 21:24:18 -04:00
Becca Royal-Gordon
9454c0aaa4 Emit module selectors in swiftinterfaces
This support is currently opt-in and can be disabled by a blocklist.
2025-10-31 16:48:06 -07:00
Allan Shortlidge
3b77e2e64a AST: Introduce experimental support for an anyAppleOS availability domain.
`anyAppleOS` represents a meta-platform for availability checks that can be
used to check availability across all of Apple's operating systems. It
supports versions 26.0 and up since version 26.0 is the first OS version number
that is aligned accross macOS, iOS, watchOS, tvOS, and visionOS.

Apple platform-specific availability specification take precedence over
`anyAppleOS` availability specifications when specified simultaneously.

Resolves rdar://153834380.
2025-10-31 15:21:30 -07:00
Alexis Laferrière
94113f4a83 SE-496: Remove references to features CDecl and CImplementation 2025-10-29 17:31:20 -07:00
Alexis Laferrière
bce585c133 SE-495: Make CImplementation an official feature 2025-10-29 11:55:51 -07:00
Alexis Laferrière
000c2604b0 SE-495: Make @c an official feature 2025-10-29 11:55:41 -07:00
Becca Royal-Gordon
393965090e Merge pull request #34556 from beccadax/mod-squad-2
[SE-0491] Implement lookup and diagnostics for module selectors (MyMod::someName)
2025-10-28 16:00:26 -07:00
Slava Pestov
233b334a47 Sema: Enable prepared overloads by default
This can be turned off with -solver-disable-prepared-overloads.
2025-10-27 21:42:11 -04:00
Kavon Farvardin
2d881bdc9c ManualOwnership: provide ability to apply to entire compilation unit
With this patch, I'm flipping the polarity of things.

The flag `-enable-experimental-feature ManualOwnership` now turns on the diagnostics,
but they're all silenced by default. So, you need to add -Wwarning or -Werror to
your build settings to turn on the specific diagnostics you care about.

These are the diagnostic groups relevant to the feature:

- SemanticCopies aka "explicit copies mode"
- DynamicExclusivity

For example, the build setting `-Werror SemanticCopies` now gives you errors about
explicit copies, just as before, but now you can make them just warnings with -Wwarning.

To opt-out a declaration from everything when using the feature, use @_noManualOwnership.

@_manualOwnership is no longer an attribute as a result.

resolves rdar://163372569
2025-10-24 18:54:07 -07:00
Becca Royal-Gordon
e6d8b02626 Make module selectors non-experimental
Approved by SE-0491.
2025-10-24 16:23:50 -07:00
Kuba (Brecka) Mracek
eb23d3bc0a Merge pull request #85074 from kubamracek/section
SE-0492: Stabilize @_section/@_used into @section/@used
2025-10-24 12:29:48 -07:00
John Hui
781489f067 Merge pull request #85021 from j-hui/return-frt-diagnostics
[cxx-interop] Put RETURNS_RETAINED warnings in a diagnostic group

rdar://161932849
rdar://144976203
2025-10-24 12:05:48 -04:00
Arnold Schwaighofer
7f36b58942 Merge pull request #85009 from aschwaighofer/embedded_existentials_feature_flag
Add experimental feature flag EmbeddedExistentials
2025-10-22 19:04:42 -07:00
Adrian Prantl
a3529784a5 Merge pull request #84412 from adrian-prantl/159531233
Serialize module dependencies in swift module files
2025-10-22 16:25:57 -07:00
Kuba Mracek
adeb40f261 SE-0492: Stabilize @_section/@_used into @section/@used
Removes the underscored prefixes from the @_section and @_used attributes, making them public as @section and @used respectively. The SymbolLinkageMarkers experimental feature has been removed as these attributes are now part of the standard language. Implemented expression syntactic checking rules per SE-0492.

Major parts:
- Renamed @_section to @section and @_used to @used
- Removed the SymbolLinkageMarkers experimental feature
- Added parsing support for the old underscored names with deprecation warnings
- Updated all tests and examples to use the new attribute names
- Added syntactic validation for @section to align with SE-0492 (reusing the legality checker by @artemcm)
- Changed @DebugDescription macro to explicitly use a tuple type instead of type inferring it, to comply with the expression syntax rules
- Added a testcase for the various allowed and disallowed syntactic forms, `test/ConstValues/SectionSyntactic.swift`.
2025-10-22 16:05:39 -07:00
Allan Shortlidge
16dee385bf AST/Basic: Introduce the StandaloneSwiftAvailability experimental feature.
This experimental feature will be used to force the compiler to treat `Swift`
runtime availability as separate from platform availability when compiling for
targets that have the Swift runtime built-in.
2025-10-21 21:55:24 -07:00
Adrian Prantl
c91211a5d2 Serialize explicit module dependencies in swift module files
For clients, such as the debugger, who do not have access the full
output of the dependency scanner, it is a huger performance and
correctness improvement if each explicitly built Swift module not just
serialized all its Clang .pcm dependencies (via the serialized Clang
compiler invocation) but also its direct Swift module dependencies.

This patch changes the Swift module format to store the absolute path
or cas cache key for each dependency in the INPUT block, and makes
sure the deserialization makes these available to the ESML.

rdar://150969755
2025-10-21 09:08:58 -07:00
Artem Chikin
4cdbcb8645 [Explicit Module Builds] Always rebuild the target module in explicit -compile-module-from-interface builds.
We have long switched to delegate the checking of whether a module is up-to-date to the build system (SwiftDriver) and stopped serializing file dependencies for interface-built binary modules.

Resolves rdar://162881032
2025-10-20 14:13:37 -07:00
Arnold Schwaighofer
22c8ea6af6 Add experimental feature flag EmbeddedExistentials
This flag can be used to gradually add the functionility that will allow use of
protocol values in embedded mode.
2025-10-20 10:18:45 -07:00
John Hui
d47a2626e2 [cxx-interop] Clean up diagnostics for functions returning FRTs
- Delete baseline language feature WarnUnannotatedReturnOfCxxFrt,
  which won't really be useful to users
- Remove some references to "cxx", since FRTs are not exclusively
  imported from C++
- Clean up lit test RUN lines to use %{fs-sep}
2025-10-19 22:22:15 -07:00
Fahad Nayyar
facef0e034 [cxx-interop] Enabling WarnUnannotatedReturnOfCxxFrt on by default and add it to a diagnostic group
This change makes the warning for unannotated C++ functions returning foreign
reference types (FRT) enabled by default, improving memory safety for Swift/C++
interop users. Also added CxxForeignReferenceType diagnostic group for better control
2025-10-17 17:06:44 -07:00
Steven Wu
4f059033bb [Caching][NFC] Using llvm::cas::CASConfiguration
Prefer llvm::cas::CASConfiguration where it used to clang::CASOption.
2025-10-17 16:42:35 -07:00
Egor Zhdan
b6dda90e87 Merge pull request #84881 from egorzhdan/egorzhdan/remove-opt-out-flag
[cxx-interop] Remove opt-out flag for constructors of foreign reference types
2025-10-15 12:17:23 +01:00
Henrik G. Olsson
f83752dd14 Merge pull request #84870 from hnrklssn/verify-ignore-macro-note
[DiagnosticVerifier] Add -verify-ignore-macro-note
2025-10-14 19:41:31 -07:00
Egor Zhdan
4e6e462c02 [cxx-interop] Remove opt-out flag for constructors of foreign reference types
The opt-out flag was never used or tested, let's remove it.

rdar://148285972
2025-10-14 18:11:12 +01:00
Henrik G. Olsson
89b31cfcf9 Merge pull request #84872 from hnrklssn/disable-safe-wrappers-in-stdlib
[Swiftify] Always skip safe wrappers when building the stdlib
2025-10-14 09:36:20 -07:00
Henrik G. Olsson
a8fec6f39b [Swiftify] Always skip safe wrappers when building the stdlib
_SwiftifyImport assumes types like Swift.Int, Swift.UnsafePointer<T> and
Swift.Span<T> are available. This is not the case when building the
stdlib itself. Disable safe interop in the stdlib to prevent errors.
This currently has no effect, but will when this feature is enabled by
default, which I have manually tested.
2025-10-13 19:11:57 -07:00
Henrik G. Olsson
da55801862 [DiagnosticVerifier] Add -verify-ignore-macro-note
The _SwiftifyImport macro is emitted into an unnamed buffer and then
parsed, pretending it was in the header all along. This makes it hard to
add `expected-note` comments for `diag::in_macro_expansion` when they
point here. That's okay, because the macro expansion has already been
pointed out by `expected-expansion` directives. But
-verify-ignore-unrelated is too blunt of a tool, so this adds
-verify-ignore-macro-note to ignore these specific diagnostics.
2025-10-13 18:35:46 -07:00
John McCall
46623cb6c7 Merge pull request #84811 from rjmccall/verify-dead-end-edges
Strengthen the SIL verifier's rules for edges into dead-end regions
2025-10-11 18:16:56 -04:00
John McCall
c610727e0c Add a utility to simplify making a dynamic choice to move or copy.
Using it with emplacing methods relies on actually have a constructor
that takes maybe_movable_ref<X>, which can be awkward. But there are
cases where just calling construct() explicitly can be helpful.
2025-10-11 02:12:18 -04:00
Pavel Yaskevich
243f550b80 Merge pull request #84777 from xedin/tilde-sendable
[AST/Sema] Implement `~Sendable` support behind an experimental feature flag
2025-10-10 14:27:20 -07:00
Doug Gregor
ce5b1a126d Merge pull request #84392 from rjmansfield/sil-ir-extra-outputs
Add frontend options to write SIL and LLVM IR as additional compilation output
2025-10-10 12:09:38 -07:00
Pavel Yaskevich
1ac87e7004 [Basic] Add an experimental feature flag to guard use of ~Sendable 2025-10-09 10:41:25 -07:00
Allan Shortlidge
1a86cd9c26 AST: Introduce a Swift runtime availability domain.
Add support for the `Swift` availability domain, which represents availability
with respect to the Swift runtime. Use of this domain is restricted by the
experimental feature `SwiftRuntimeAvailability`.
2025-10-08 17:31:57 -07:00
Allan Shortlidge
2d8465b043 AST: Introduce the SwiftLanguageMode availability domain spelling.
Require `-enable-experimental-feature SwiftRuntimeAvailability` to use this new
spelling.
2025-10-08 15:46:34 -07:00
John Hui
312caa3a82 Merge pull request #84723 from j-hui/suppress-notes
[Diagnostics] Add -suppress-notes flag
2025-10-07 11:18:22 -07:00