Commit Graph

2045 Commits

Author SHA1 Message Date
Pavel Yaskevich
7b8f76e3c4 Merge pull request #73007 from xedin/promote-dynamic-actor-isolation-to-upcoming-feature
[SE-0423] Promote `DynamicActorIsolation` to an upcoming feature and add a way to disable checks
2024-04-16 11:46:41 -07:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
Pavel Yaskevich
d366c0cd93 [Frontend] NFC: Add a flag to explicitly disable DynamicActorIsolation feature 2024-04-14 21:28:13 -07:00
Rintaro Ishizaki
a16ad9c274 Merge pull request #71173 from rintaro/cmake-parservalidatoin
[CMake] Add option to perform SwiftParser validation by default
2024-04-12 15:03:31 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Steven Wu
0e12f2042e [ScanDependency] Move binary module validation into scanner
Improve swift dependency scanner by validating and selecting dependency
module into scanner. This provides benefits that:
* Build system does not need to schedule interface compilation task if
  the candidate module is picked, it can just use the candidate module
  directly.
* There is no need for forwarding module in the explicit module build.
  Since the build system is coordinating the build, there is no need for
  the forwarding module in the module cache to avoid duplicated work,
* This also correctly supports all the module loading modes in the
  dependency scanner.

This is achieved by only adding validate and up-to-date binary module as
the candidate module for swift interface module dependency. This allows
caching build to construct the correct dependency in the CAS. If there
is a candidate module for the interface module, dependency scanner will
return a binary module dependency in the dependency graph.

The legacy behavior is mostly preserved with a hidden frontend flag
`-no-scanner-module-validation`, while the scanner output is mostly
interchangeable with new scanner behavior with `prefer-interface` module
loading mode except the candidate module will not be returned.

rdar://123711823
2024-04-05 07:52:14 -07:00
Michael Gottesman
b3e837c16c [region-isolation] Enable region isolation by default with strict-concurrency.
I added a disable flag -disable-region-based-isolation-with-strict-concurrency
so that we do not need to update the current tests. It is only available when
asserts are enabled to ensure users cannot use it.

rdar://125918028
2024-04-04 13:07:32 -07:00
Meghana Gupta
2a5ba00ab9 Merge pull request #68036 from meg-gupta/enableptrauth
Enable importing ptrauth qualified function pointers from c by default
2024-04-03 10:49:03 -07:00
Meghana Gupta
09580fc27a Enable importing ptrauth qualified function pointers from c by default
rdar://109235426
2024-04-02 23:59:47 -07:00
Ben Barham
1fdda023b3 Rename StringRef::endswith references to StringRef::ends_with
Missed this when doing the `startswith` renaming. `endswith` has also
been deprecated upstream (and presumably soon to be removed).
2024-04-01 10:59:16 -07:00
Kuba (Brecka) Mracek
4fd6adb99e Merge pull request #72669 from kubamracek/embedded-drop-all-sil-flag
[embedded] Add a frontend flag to drop all code from a module and emit an empty object file
2024-03-29 15:09:51 -07:00
Artem Chikin
d9c00d8dd6 Merge pull request #72668 from artemcm/DepScanBinaryModuleHeaderDepModuleDeps
[Explicit Module Builds] Only specify '-fmodule-map-file' for bridging header Clang module dependencies
2024-03-29 09:02:10 -07:00
Kuba Mracek
70781b2dc4 [embedded] Avoid DropAllSILPass, reuse StopOptimizationAfterSerialization instead 2024-03-28 15:32:19 -07:00
Allan Shortlidge
12fccfc4e0 Frontend: Really allow any experimental feature when compiling a module interface.
The fix for https://github.com/apple/swift/pull/72632 was not sufficient
because when modules are built from textual interface that happens in a
sub-invocation which does not have typecheck-from-interface or
compile-from-interface requested action. Instead of checking a requested
action, set a language option to control whether non-production experimental
features are allowed.

Resolves rdar://125561443
2024-03-28 14:48:15 -07:00
Artem Chikin
f3816e0335 [Explicit Module Builds] Only specify '-fmodule-map-file' for bridging header Clang module dependencies
Relying on the corresponding field in the '-explicit-swift-module-map-file' provided by the driver.

Only bridging headers require a module map because that's what aids header include resolution. With lazy module loading today, '.modulemap' parsing which happens when instantiating Clang is responsible for associating headers with modules. Then upon encountering a header include inside the bridging header the compiler knows which module corresponds to said header and is then able to load explicitly-provided PCM for that module. For all other module dependencies, they are only ever queried by-name from Swift, so '.modulemap' parsing is not necessary.
2024-03-28 13:47:13 -07:00
Kuba Mracek
90e7595df5 [embedded] Add a frontend flag to drop all code from a module and emit an empty object file 2024-03-28 11:03:50 -07:00
Allan Shortlidge
590d3353e6 Frontend: Introduce an alias for the IsolatedAny experimental feature.
To preserve compatibility with older compilers that do not allow `IsolatedAny`
to be enabled in production compilers, use an alias experimental feature when
building the stdlib (`IsolatedAny2`).

Also, add `@_allowFeatureSuppression(IsolatedAny)` in a couple spots it was
forgotten.

Partially resolves rdar://125138945
2024-03-27 22:20:50 -07:00
Allan Shortlidge
2813fbe309 Frontend: Introduce an alias for the NoncopyableGenerics experimental feature.
The `.swiftinterface` of the standard library must remain compatible with some
older compilers. Unfortunately, some of those older compilers do not allow the
experimental feature `NoncopyableGenerics` to be enabled in production. To
allow the stdlib to build with non-copyable generics enabled and still have the
older compilers consume its interface, we have to use a new experimental
feature identifier that they do not know about.

Partially resolves rdar://125138945
2024-03-27 22:20:25 -07:00
Allan Shortlidge
b11b64273b Frontend: Allow any experimental feature to be enabled when compiling a module.
When building a module from its interface, do not diagnose whether or not a
feature is available in production compilers. This is important since older
compilers may be expected to build .swiftinterfaces that were produced by newer
compilers where the feature has been enabled by default.

Resolves rdar://125500318
2024-03-27 11:43:48 -07:00
Andrew Trick
38d9557481 Options for complete OSSA lifetimes.
Adds
-disable-ossa-complete-lifetimes,
-enable-ossa-verify-complete,
-disable-ossa-verify-complete
2024-03-21 16:32:10 -07:00
Kavon Farvardin
76c6510519 Merge pull request #72276 from kavon/ncgenerics-xfails-3 2024-03-16 04:18:35 -07:00
Ellie Shin
45126a8a2d Formatting 2024-03-15 15:31:42 -07:00
Ellie Shin
951e2abdea Create features mapped to package optimization flags to
allow a more standard way to pass experimental features
from build systems. Also moved other flags relevant to
diagnostics from Frontend options to Lang options.

Ref: rdar://124648653
2024-03-15 14:18:33 -07:00
Kavon Farvardin
149c052ec5 use new noncopyable types infrastructure
The infrastructure underpinning the new feature NoncopyableGenerics is
mature enough to be used.
2024-03-14 23:10:44 -07:00
Alexis Laferrière
3c8af3ed93 Merge pull request #72321 from xymus/spi-only-swift-6
Frontend: Allow use of `@_spiOnly` by default in Swift 6
2024-03-14 16:05:53 -07:00
Ben Barham
cbcfc85777 Merge pull request #72323 from bnbarham/rename-startswith
Rename startswith to starts_with
2024-03-14 09:06:54 -07:00
Alastair Houghton
1119a6ecbb Merge pull request #71845 from al45tair/eng/PR-123506588
[Frontend] Use the `swift_static` directory when appropriate.
2024-03-14 15:25:05 +00:00
Alexis Laferrière
fb59f1fb11 Frontend: Enable @_spiOnly by default in Swift 6
Enabling `@_spiOnly` also enables stronger type-checking of SPI decls.
As this could be source breaking, it has always been opt-in. Turn it on
by default in Swift 6 mode where the stronger type-checking will also
become expected.

At the same time, disable the old alternative to `@_spiOnly` which was
designed to be compatible with old compilers. Any user of that feature
should move to `@_spiOnly` or `package import` instead.
2024-03-14 07:06:36 -07:00
Ben Barham
9779c18da3 Rename startswith to starts_with
LLVM is presumably moving towards `std::string_view` -
`StringRef::startswith` is deprecated on tip. `SmallString::startswith`
was just renamed there (maybe with some small deprecation inbetween, but
if so, we've missed it).

The `SmallString::startswith` references were moved to
`.str().starts_with()`, rather than adding the `starts_with` on
`stable/20230725` as we only had a few of them. Open to switching that
over if anyone feels strongly though.
2024-03-13 22:25:47 -07:00
Steven Wu
495a17743a Merge pull request #72168 from cachemeifyoucan/eng/PR-124222904
[Caching] Normalize DebugInfo flags
2024-03-13 13:13:32 -07:00
Ellie Shin
56d337d322 Merge pull request #72249 from apple/es/pkg-cmo 2024-03-13 09:26:35 -07:00
Arnold Schwaighofer
315a763c28 Merge pull request #72218 from aschwaighofer/fragile_resilient_protocols
IRGen: Add code to support building fragile resilient protocol witnesses
2024-03-13 08:40:44 -07:00
Ellie Shin
a3250e426d Support Package CMO
* Add a new flag -experimental-package-cmo that requires -experimental-allow-non-resilient-access.
* Support serializing package decls for CMO in package if enabled.
* Only applies to default mode CMO.
* Unlike the existing CMO, package CMO can be built with -enable-library-evolution as package
modules are required to be built together in the same project.
* Create hasPublicOrPackageVisibility to opt in for package decls; needed for CMO, SILVerifier,
and other call sites that verify or determine codegen.

Resolves rdar://121976014
2024-03-12 15:00:24 -07:00
Steven Wu
177bbe64d4 Merge pull request #71118 from cachemeifyoucan/eng/PR-119275464
[Caching] Create clang importer from cc1 args directly
2024-03-11 13:50:34 -07:00
Steven Wu
d38caf15cf [Caching] Normalize DebugInfo flags in DWARF
Do not encode cache invariant command-line flags in DWARF since those
flag should not affect code generation or diagnostics. This avoids
generating conflicting cache entry when caching is enabled, and will
make normal incremental builds more likely to hit fast skip codegen
path.

rdar://124222904
2024-03-11 10:37:31 -07:00
Arnold Schwaighofer
9639e007d8 Teach TBD that in fragile resilient protocol mode the protocol table is visible 2024-03-11 09:49:38 -07:00
Arnold Schwaighofer
ea70aea43c IRGen: Add code to support building fragile resilient protocol witnesses
We don't currently support building resilient relative protocol witness tables.
One might want to build with relative witness tables but not need
resilient protocols. Allow for that scenario.

Add a test configuration to test library-evolution + fragile resilient
protocols + relative protocol witness tables.
2024-03-10 09:14:08 -07:00
Slava Pestov
123045f825 Merge pull request #71780 from slavapestov/remove-non-experimental-assoc-type-inference
Remove old associated type inference implementation
2024-03-07 22:14:06 -05:00
Steven Wu
cb17ea8e66 [ScanDependency] Add -experimental-clang-importer-direct-cc1-scan
Add an experimental option to tell dependency scanner to report clang
cc1 args should be used to construct clang importer in all constructed
swift-frontend tasks.
2024-03-07 14:40:00 -08:00
Steven Wu
cdeef58e0f [Caching] Create clang importer from cc1 args directly
When caching build is enabled, teach dependency scanner to report
command-lines with `-direct-clang-cc1-module-build` so the later
compilation can instantiate clang importer with cc1 args directly. This
avoids running clang driver code, which might involve file system
lookups, which are the file deps that are not captured and might result
in different compilation mode.

rdar://119275464
2024-03-07 14:40:00 -08:00
Slava Pestov
af8c8f1671 Sema: Remove non-experimental associated type inference 2024-03-07 17:30:17 -05:00
Andrew Trick
093aed967c Enable lifetime dependence diagnostics for Nonescapable types.
Adds -Xfrontend -disable-lifetime-dependence-diagnostics.

Removes -Xllvm -enable-lifetime-dependence-insertion

Removes -Xllvm -enable-lifetime-dependence-diagnostics
2024-03-07 13:40:25 -08:00
Becca Royal-Gordon
fd9ae4c8ac Merge pull request #72023 from beccadax/lazy-objc-workaround
Add workaround flag for lazy import-as-member
2024-03-05 16:12:32 -08:00
Becca Royal-Gordon
54fd4b01b6 Add workaround flag for lazy import-as-member
In rdar://123649082, a project failed to build because of the lazy import-as-member loading changes in #71320. That project was configured in a way that broke modularization and the correct solution is to fix it, but out of an abundance of caution, add a `-disable-named-lazy-import-as-member-loading` frontend flag in case a project needs to temporarily restore the old behavior.

As a bonus, this lets us write a test to verify that lazy import-as-member loading has positive performance impact.
2024-03-05 11:09:17 -08:00
Steven Wu
3e903688a2 [ScanDependency] Do not use public/private swiftinterface in the same package
When scanning finds a dependency in the same package, do not load
public/private swiftinterface since they do not have the package level
decl to compile the current module. Always prefer package module (if
enabled), or use binary module, unless it is building a public/private
swiftinterface file in which case the interface file is preferred.

This also does some clean up to sync up the code path between implicit
and explicit module finding path.

rdar://122356964
2024-02-28 17:34:03 -08:00
Doug Gregor
0c9c734f7e Merge pull request #71722 from DougGregor/diagnostic-style-swift-default 2024-02-24 14:42:38 -10:00
Alastair Houghton
786e178113 [Frontend] Use the swift_static directory when appropriate.
We should be using `/usr/lib/swift_static` and not `/usr/lib/swift`
when we're using the static resource directory.

rdar://123506588
2024-02-23 16:01:56 +00:00
Mishal Shah
cb96ec2893 Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-22 09:44:44 -08:00
Ben Barham
5637284e48 Merge pull request #71368 from bnbarham/std-optional-all-the-things
Migrate llvm::Optional to std::optional
2024-02-21 16:54:00 -08:00
Mishal Shah
b8cd763b21 Merge branch 'main' into bump-swift-version-to-6 2024-02-21 12:40:54 -08:00