Commit Graph

4649 Commits

Author SHA1 Message Date
Chris McGee
1380a3e2a9 Merge pull request #83044 from cmcgee1024/add_more_symbol_graph_opts_swiftc
Add pretty print and skip synthesized members to the frontend options
2025-09-09 15:24:27 -04:00
Doug Gregor
66a730b638 [Embedded] Remove -mergeable-symbols
This option is no longer necessary, because we emit weak definitions
for any imported modules. Fixes rdar://158364032.
2025-09-08 17:44:51 -07:00
Chris McGee
b8ab5d548d Set driver options for frontend too and propagate them in compiler invocation 2025-09-08 16:41:11 -04:00
Richard Howell
0b829bfab1 Add error messages for Swift module map parser
Parser errors with large Swift module map files can be hard to diagnose.
Refactor the parser to return an llvm::Error so clearer diagnostics can
be passed to the user.
2025-09-05 13:53:26 -07:00
Arnold Schwaighofer
6da200f047 Merge pull request #84009 from aschwaighofer/assembly_vision_all_the_things
Add a flag to annotate all functions with the `optremark` (`@_assemblyVision`) attribute
2025-09-04 08:57:44 -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
Arnold Schwaighofer
df5a8cd3cc Add a flag to annotate all functions with the optremark (@_assemblyVision) attribute
rdar://159291169
2025-08-29 09:26:13 -07:00
Steven Wu
94f7c5471a Merge pull request #83878 from cachemeifyoucan/eng/PR-134363755
[Caching] Do not infer default on disk cas path when parsing options
2025-08-26 12:36:51 -07:00
Steven Wu
492f5ab611 [Caching] Do not infer default on disk cas path when parsing options
Currently, swift-frontend will always try to infer a default CASPath if
no `-cas-path` is passed. The function `getDefaultOnDiskCASPath` called
to infer the default path can fatal error in some environment where no
caching directory and home directory, no matter if caching is used or
not.

Remove the inferred path during parsing since that is not strictly
necessary. If caching is enabled and no CASPath is passed, error can be
issued during CAS construction time.

rdar://158899187
2025-08-22 12:32:24 -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
Steven Wu
b18e865b0a [Caching] Fix typecheck swiftinterface with prefix map
SwiftVerifyEmittedModuleInterface job is configured to be built within
the SubInvocation and it needs to inherit the caching replay prefix map
in order to load macro plugin library correctly.

rdar://158692095
2025-08-19 10:28:20 -07:00
Kuba Mracek
169ea0089d [embedded] Also specify -enable-experimental-feature Embedded to sub-invocations 2025-08-18 17:08:45 -07:00
Kuba Mracek
0f2911f3b7 [embedded] When loading (sub-)modules, propagate the Embedded flag and use it for hash computation 2025-08-18 12:18:34 -07:00
Hamish Knight
5e27e83456 Merge pull request #83613 from hamishknight/next-step
[IDE] Perform extension binding after AST mutation
2025-08-13 22:37:56 +01:00
Allan Shortlidge
e35843efa7 Fix build failure in ArgsToFrontendOptionsConverter.cpp.
```
error: no member named 'PrintClangStats' in 'swift::FrontendOptions'
```

Resolves rdar://158206551.
2025-08-13 08:47:55 -07:00
Allan Shortlidge
5d3d93478a Frontend: Inherit compiler debugging options during module interface actions.
When building a module interface for the -typecheck-module-from-interface or
-compile-module-from-interface actions, inherit and honor compiler debugging
options and emit debugging output at the end of the interface build.
2025-08-12 15:48:42 -07:00
Allan Shortlidge
512cf21148 Frontend: Make -dump-availability-scopes an option instead of a mode.
Allowing it to be specified in conjunction with any frontend mode makes it a
more flexible debugging tool.
2025-08-12 10:18:33 -07:00
Chris McGee
eed54bb4b0 Reduce change to compiler invocation and remove options from frontend 2025-08-12 12:04:02 -04:00
Hamish Knight
03dd5a2c26 [Frontend] Split off loadAccessNotesIfNeeded
This ought to be requestified, but for now let's split it into its
own function.
2025-08-10 23:49:03 +01:00
Evan Wilde
3fcca83d07 Refactor getMinPlatformVersion
The definitions of how version numbers were extracted from target
triples split between the minimum platform version and for determining
the minimum inlining version.

This resulted in inlinable and transparent functions not being imported
correctly on non-Apple platforms where the version number is retained as
part of the target triple.
Specifically, `_checkExpectedExecutor` was found in the module, but
didn't have the appropriate availability version assigned, resulting in
it failing to import and the compiler silently omitting the check in
SILGen when compiling for FreeBSD.

This patch refactors the implementation of `getMinPlatformVersion` into
a separate function that is used in both places so that they cannot get
out of sync again.

Note: This changes how Windows is handled. getMinPlatformVersion
returned an empty version number for Windows, while the availability
implementation returned the OS version number. This makes both
consistently return the OS version number.
2025-08-08 15:10:04 -07:00
Chris McGee
6a38bbe73d Qualify the skip synthesized members option with symbol graph for the compiler frontend
Rollback the additional usages of the new options and test cases
2025-08-07 15:44:33 -04:00
Alexis Laferrière
2ae485a6fd Merge pull request #83246 from xymus/cxx-swiftmodules
Serialization: Consider C++ interop use in module cache hash, preventing collisions
2025-08-05 09:33:21 -07:00
Alexis Laferrière
f8d6bedfae Serialization: Consider the C++ interop use in module cache hash
It is expected to rebuild modules from swiftinterface when the C++
interop is enabled in clients. The swiftmodule produced is different.
Make sure the rebuilt module is kept under a distinct cache key to avoid
reusing previously compiled modules in an incompatible mode.
2025-08-01 16:39:28 -07:00
Hamish Knight
fb7f2d0ff2 [CS] Limit the number of chained @dynamicMemberLookup lookups
Set an upper bound on the number of chained lookups we attempt to
avoid spinning while trying to recursively apply the same dynamic
member lookup to itself.

rdar://157288911
2025-08-01 19:08:04 +01:00
Chris McGee
26168f57cc Create tests for the two new symbol graph options
Add options to the driver and frontend options
2025-07-30 10:24:56 -04:00
Anthony Latsis
fec049e5e4 Address llvm::PointerUnion::{is,get} deprecations
These were deprecated in
https://github.com/llvm/llvm-project/pull/122623.
2025-07-29 18:37:48 +01:00
Doug Gregor
436e965b66 [SE-0466] Under main actor default isolation, explicit nonisolated is not special
Given an explicitly-nonisolated type such as

    nonisolated struct S { }

all extensions of S were also being treated as nonisolated. This meant
that being implicitly nonisolated (i.e., when you're using nonisolated
default isolation) was different from explicitly-writing nonisolated,
which is unfortunate and confusing. Align the rules, such that an
extension of S will get default isolation:

    extension S {
      func f() { } // @MainActor if we're in main actor default isolation
    }
2025-07-25 09:46:34 -07:00
Artem Chikin
b60bc39ee5 [APINotes] Add support for handling Clang modules carrying all versions of APINotes
Controlled from Swift with '-version-independent-apinotes', which, for the underlying Clang invocation enables '-fswift-version-independent-apinotes', results in PCMs which aggregate all versioned APINotes wrapped in a 'SwiftVersionedAttr', with the intent to have the client pick and apply only those that match its current Swift version, discarding the rest.

This change introduces the configuration flags for this mode as well as the corresponding logic at the beginning of `importDeclImpl` to canonicalize versioned attributes, i.e. select the appropriate attributes for the current target and discard the rest.
2025-07-24 09:08:31 -07:00
Kuba (Brecka) Mracek
407ef9a302 Merge pull request #83238 from kubamracek/const-cgfloat-typedef
[ClangImporter] Skip importing values for CGFloat typedefs on top of CGFloats direct
2025-07-23 10:43:24 -07:00
Anthony Latsis
c7b51edf0a Merge pull request #83204 from swiftlang/jepa-main
Address rebranch deprecations
2025-07-23 06:00:57 +01:00
Kuba Mracek
6ec280d4e1 [ClangImporter] Skip importing values for CGFloat typedefs on top of CGFloats direct 2025-07-22 10:10:15 -07:00
Steven Wu
a24c34252f [SwiftCaching] Create standalone reproducer from swift caching build
Add a new option `-gen-reproducer` that when swift caching is used,
create a standalone reproducer that can be used to reproduce the
`swift-frontend` invocation.
2025-07-21 14:16:48 -07:00
Anthony Latsis
2920ea84d1 Address llvm::(Mutable)ArrayRef ctor deprecations
See:
- https://github.com/llvm/llvm-project/pull/146113
- https://github.com/llvm/llvm-project/pull/146011
2025-07-21 12:36:53 +01:00
Slava Pestov
bb4f61e97b Merge pull request #83141 from slavapestov/fix-rdar82992151
Sema: Improve the infinite opaque return type check
2025-07-19 09:30:17 -04:00
Slava Pestov
4eaa7e3b47 AST: Add -max-substitution-count= and -max-substitution-depth= frontend flags 2025-07-18 20:03:03 -04:00
Slava Pestov
f909ca6921 Frontend: Clean up integer option parsing in ParseLangArgs() 2025-07-18 20:03:03 -04:00
Artem Chikin
bd14089551 Warn on multiple '-swift-module-file' options 2025-07-18 10:05:55 -07:00
Artem Chikin
e08b78226c [Dependency Scanning] Consider '-swift-module-file' inputs when looking for dependencies
Previously this flag was only used to pass explicit dependencies to compilation tasks. This change adds support for the dependency scanner to also consider these inputs when resolving dependencies.

Resolves https://github.com/swiftlang/swift-driver/issues/1951
2025-07-18 09:48:02 -07:00
Gábor Horváth
4b9ef8c53c Merge pull request #83130 from Xazax-hun/objc-configurable-from-frontend
[cxx-interop] Configure requires ObjC from frontend option
2025-07-18 02:29:48 +01:00
Gabor Horvath
4b64abdc45 [cxx-interop] Configure requires ObjC from frontend option
We sometimes don't have the information in the modulemaps whether a
module requires ObjC or not. This info is useful for reverse interop.
This PR introduces a frontend flag to have a comma separated list of
modules that we should import as if they had "requires ObjC" in their
modulemaps.
2025-07-17 21:29:50 +01:00
Steven Wu
fbfc7a6f71 Merge pull request #82745 from sina-mahdavi/sina-mahdavi/new-scanner-prefix-map-option
Add `-scanner-prefix-map-paths` to the frontend
2025-07-17 11:35:06 -07:00
Anthony Latsis
90f9fce339 Merge pull request #82665 from swiftlang/jepa4
Bridging: Bridge some basic classes like `swift::SourceLoc` directly
2025-07-16 08:27:12 +01:00
Sina Mahdavi
03843475c1 Add -scanner-prefix-map-paths to the frontend 2025-07-15 10:46:50 -07:00
Chris McGee
b27bc18d36 Add pretty print and skip synthesized members options to swiftc 2025-07-14 16:09:55 -04:00
Anthony Latsis
06a5670c8f Basic: Untie swift::SourceLoc from llvm::SMLoc
Storing a `llvm::SMLoc` is a superfluous indirection, and getting rid of
it enables us to unconditionally import `SourceLoc` into Swift.
2025-07-11 18:48:42 +01:00
Allan Shortlidge
302fa00a31 Merge pull request #82962 from tshortli/layout-prespecialization-feature 2025-07-10 21:28:36 -07:00
Allan Shortlidge
c6dad96492 Make LayoutPrespecialization a baseline feature instead of experimental.
Since LayoutPrespecialization has been enabled by default in all compiler
invocations for quite some time, it doesn't make sense for it to be treated as
experimental feature. Make it a baseline feature and remove all the
checks for it from the compiler.
2025-07-10 11:25:28 -07:00
Allan Shortlidge
3d722e1919 ClangImporter: Generate and call custom availability domain predicates.
When importing custom availability domains with dynamic predicates from Clang
modules, synthesize predicate functions for `if #available` queries and call
them when generating SIL.

Resolves rdar://138441312.
2025-07-10 08:15:01 -07:00
Meghana Gupta
0bf1faec25 Merge pull request #82909 from aschwaighofer/opt_remarks_supp_output
Opt-remarks: Only set opt remarks supplementary output files if they …
2025-07-09 16:42:22 -07:00
Arnold Schwaighofer
36f9a7514a Opt-remarks: Only set opt remarks supplementary output files if they are actually
requested via -save-optimization-remarks and we indeed produce them

rdar://154908721
2025-07-09 06:29:45 -07:00