Commit Graph

4308 Commits

Author SHA1 Message Date
Arnold Schwaighofer
7853ba0a7f Merge pull request #84178 from aschwaighofer/inline_always
Add experimental feature `@inline(always)`
2025-10-01 07:23:24 -07:00
Doug Gregor
c4527dc47d Merge pull request #84580 from DougGregor/static-build-configure 2025-09-30 20:47:04 -07:00
Arnold Schwaighofer
25a071efc8 Add experimental feature @inline(always)
The intent for `@inline(always)` is to act as an optimization control.
The user can rely on inlining to happen or the compiler will emit an error
message.

Because function values can be dynamic (closures, protocol/class lookup)
this guarantee can only be upheld for direct function references.

In cases where the optimizer can resolve dynamic function values the
attribute shall be respected.

rdar://148608854
2025-09-30 08:36:26 -07:00
Doug Gregor
2a46916536 Reseat CompilerBuildConfiguration on top of StaticBuildConfiguration
Now that we have a per-ASTContext StaticBuildConfiguration, reimplement
(almost) everything in CompilerBuildConfiguration to sit on top of it.
Only canImport requires the full ASTContext, so that gets its own
implementation, as does one other operation that can produce an error.
Aside from more code sharing, this provides additional validation that
the StaticBuildConfiguration we build is complete and accurate.
2025-09-29 18:42:15 -07:00
Doug Gregor
3082b04b75 [Macros] Feed the static build configuration into macro expansions
Thread the static build configuration (formed from language options) in
to the macro plugin handler, which will serialize it for use in the
macro implementation. test this with a simple macro that checks
whether a particular custom configuration (set via `-D`) is enabled or
not.

This required some re-layering, sinking the logic for building a
StaticBuildConfiguration from language options down into a new
swiftBasicSwift library, which sits on top of the C++ swiftBasic and
provides Swift functionality for it. That can be used by the C++
swiftAST to cache the StaticBuildConfiguration on the ASTContext,
making it available for other parts of ASTGen.
2025-09-29 18:42:15 -07:00
swift-ci
b2a0c63a95 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-27 18:14:12 -07:00
Michael Gottesman
52a163fa5e Merge pull request #84555 from gottesmm/pr-4f37ab5228b75850c247af4f8dd913996a0390bd
[irgen] Make HasAArch64TBI an IRGen option instead of a LangOpts.
2025-09-27 18:09:12 -07:00
Michael Gottesman
361e63c815 [irgen] Make HasAArch64TBI an IRGen option instead of a LangOpts.
With some changes that I am making, we will no longer need this flag at the SIL
level, so we can just make it an IRGen flag (which it really should have been
in the first place).
2025-09-27 14:44:36 -05:00
swift-ci
e35756ef85 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-23 15:38:03 -07:00
Doug Gregor
0737723c5c Merge pull request #84465 from DougGregor/has-feature-library-evolution
Add an optional language feature for Library Evolution
2025-09-23 15:18:48 -07:00
swift-ci
7b46c3a797 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-23 15:16:42 -07:00
Alexis Laferrière
e5a9b6463d Merge pull request #84381 from xymus/rename-cdecl-to-c
Parser: Rename the experimental attribute `@cdecl` to the shorter `@c`
2025-09-23 14:58:46 -07:00
swift-ci
9372966674 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-22 23:16:05 -07:00
Doug Gregor
90a5a0f87d Merge pull request #84410 from DougGregor/internal-import-bridging-header 2025-09-22 23:09:07 -07:00
Doug Gregor
c68ef1cf71 Add an optional language feature for Library Evolution
Replace the one-off compiler flag for Library Evolution with an
optional language feature. This makes the
`hasFeature(LibraryEvolution)` check work in an `#if`, and is
otherwise just cleanup.

Tracked by rdar://161125572.
2025-09-22 17:45:34 -07:00
swift-ci
ce0f17aeac Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 21:35:40 -07:00
Henrik G. Olsson
7fcc72f108 Merge pull request #81859 from swiftlang/swiftify-inherit-imports
[MacrosOnImports][Swiftify] Copy module imports from clang node's module to its Swift macro SourceFile
2025-09-19 21:21:09 -07:00
Doug Gregor
2383d7ab2d Introduce "-internal" variant of bridging header import flags
The flags "-import-bridging-header" and "-import-pch" import a bridging
header, treating the contents as a public import. Introduce
"internal-" variants of both flags that provide the same semantics,
but are intended to treat the imported contents as if they came in
through an internal import. This is just plumbing of the options for
the moment.
2025-09-19 16:49:11 -07:00
swift-ci
0292981879 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 16:35:25 -07:00
Alexis Laferrière
97002e1ee0 Merge pull request #84373 from xymus/le-import-warn
Sema: Limit errors on LE importing non-LE modules to SDK modules
2025-09-19 16:34:48 -07:00
swift-ci
647f66ad2b Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 14:18:04 -07:00
Slava Pestov
21e34e3189 Merge pull request #84400 from slavapestov/prepared-overloads-flag
Sema: Add -solver-{enable,disable}-prepared-overloads frontend flags
2025-09-19 17:13:23 -04:00
Alexis Laferrière
9ec824c20b Parser: Rename the experimental attribute @cdecl to @c
There's no users of `@cdecl` yet so we can do a direct rename. The
legacy `@_cdecl` remains unaffected.
2025-09-19 11:55:07 -07:00
swift-ci
3a31109821 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 10:35:08 -07:00
Anthony Latsis
b7b4b57799 Merge pull request #84391 from swiftlang/jepa-main5
tools: Set Swift bug report message in some executable targets
2025-09-19 18:15:20 +01:00
Anthony Latsis
ea5d89d0d0 tools: Set Swift bug report message in some executable targets
If these programs crash, we want them to print the Swift bug report
message, not the default LLVM one, which leads to
https://github.com/llvm/llvm-project/issues.

While here, hoist the setting of the bug report message to the
START_PROGRAM macro so that we don't forget to set it in the future.
2025-09-19 12:05:31 +01:00
swift-ci
ca93b4b068 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 16:17:26 -07:00
Slava Pestov
2deb5ff0a5 Sema: Add -solver-{enable,disable}-prepared-overloads frontend flags 2025-09-18 15:05:43 -04:00
Alexis Laferrière
3a7cf4747c Sema: Reorder the cases of LibraryLevel from less to more public 2025-09-18 09:39:35 -07:00
Kavon Farvardin
61fe8a9b8e introduce @_manualOwnership performance attribute
This attribute forces programmers to acknowledge every
copy that is required to happen in the body of the
function. Only those copies that make sense according
to Swift's ownership rules should be "required".

The way this is implemented as of now is to flag each
non-explicit copy in a function, coming from SILGen, as
an error through PerformanceDiagnostics.
2025-09-17 13:51:57 -07:00
Henrik G. Olsson
928cc6c83e [ClangImporter] Deduplicate imports copied from submodule to TLM
The imported top-level module inherits the imports of all its
(transitive) submodules. Since multiple submodules can import the same
modules these need to be deduplicated to avoid redundant work.
2025-09-16 21:10:03 -07:00
Henrik G. Olsson
17c0e564e8 Add hidden --dump-source-file-imports flag
This flag dumps all imports for each SourceFile after it's gone through
import resolution. It is only intended for testing purposes.
There are other ways to print imports, but they don't correspond 1:1 to
the imports actually resolved, which is a bit problematic when testing
implicit clang module imports.
2025-09-16 21:09:59 -07:00
swift-ci
0d2c4ca9be Merge remote-tracking branch 'origin/main' into rebranch 2025-09-15 10:29:21 -07:00
Meghana Gupta
c764244df0 Merge pull request #84180 from meg-gupta/borrowandmutatepr
Add preliminary support for borrow accessors
2025-09-15 10:01:15 -07:00
swift-ci
bf9d79f5c1 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-13 06:17:00 -07:00
Hamish Knight
6ef8f45659 NFC: Move AccessNotesPath to LangOptions 2025-09-11 16:54:08 +01:00
Meghana Gupta
459a95888c Add a new experimental feature for borrow and mutate accessors 2025-09-09 13:52:27 -07:00
swift-ci
07b17d605e Merge remote-tracking branch 'origin/main' into rebranch 2025-09-04 06:17:38 -07:00
Doug Gregor
ed93b46fa6 [Embedded] Introduce DeferredCodeGen feature.
Introduce an experimental feature DeferredCodeGen, that defers the
generation of LLVM IR (and therefore object code) for all entities
within an Embedded Swift module unless they have explicitly requested
to not be emitted into the client (e.g., with
`@_neverEmitIntoClient`).

This feature is meant to generalize and subsume
-emit-empty-object-file, relying on lazy emission of entities rather
than abruptly ending the compilation pipeline before emitting any IR.

Part of rdar://158363967.
2025-09-03 15:55:47 -07:00
swift-ci
94f8b0d0e3 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-25 17:03:36 -07:00
Michael Gottesman
bfecaa357f [frontend] Expose via a LangOption whether or not the compiler is compiling for a triple that supports AArch64 TBI.
Just breaking down layers of a larger patch to make it easier to review.
2025-08-21 12:52:49 -07:00
swift-ci
61a93fff56 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-20 22:03:38 -07:00
Slava Pestov
450f43f3f1 Merge pull request #83834 from slavapestov/subst-limit
AST: Allow substitution limits >= 32767
2025-08-20 22:17:57 -04:00
Slava Pestov
d80ad918d9 AST: Tweak substitution limits again
Fixes rdar://158608098.
2025-08-20 16:42:03 -04:00
swift-ci
0886d7a09d Merge remote-tracking branch 'origin/main' into rebranch 2025-08-20 09:18:03 -07:00
Pavel Yaskevich
a7ecd309d4 [AST] SE-0487: Promote NonexhaustiveAttribute to a language feature
The proposal [has been accepted](https://forums.swift.org/t/accepted-se-0487-nonexhaustive-enums/81508)
which makes the feature experimental no longer.
2025-08-20 00:39:51 -07:00
swift-ci
dda2ca64f3 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-19 19:17:51 -07:00
Meghana Gupta
9f435ad5bd Promote LifetimeDependenceMutableAccessors and InoutLifetimeDependence to language features
These were added to guard specific source code in swift interface files for older compilers.
They do not guard any experimental language feature specifically.
Turn them on by default to prevent unnecessary flags developers need to add in their configs.
2025-08-19 11:50:49 -07:00
swift-ci
ab9176fa4b Merge remote-tracking branch 'origin/main' into rebranch 2025-08-16 02:24:41 -07:00
Gabor Horvath
2a9f6f89e3 Revert "Merge pull request #83483 from Xazax-hun/turn-off-addressable"
Afteri #83712 landed, let's make another try enabling addressable
parameters by default.

This reverts commit 61d60eb6ad, reversing
changes made to 670f69eadc.
2025-08-15 15:28:20 +01:00