Commit Graph

2070 Commits

Author SHA1 Message Date
Rauhul Varma
808ccd47ff [SymbolGraphGen] Handle cxx module imports in swift-symbolgraph-extract
Updates swift-symbolgraph-extract to parse "-cxx-interoperability-mode"
flags and update the underlying compiler invocation. This fixes a bug
where were are unable to extract the symbol graph from swiftmodules with
transitive cxx modules because we parsed cxx headers as c headers.

rdar://128888548 (Add support for parsing cxx headers)
2024-05-29 13:03:27 -07:00
Tim Kientzle
65f78e6268 Merge pull request #73675 from tbkka/tbkka-assertions-v2
New assertions support
2024-05-28 17:25:21 -07:00
Allan Shortlidge
8607953aea Frontend: Lift restrictions on lazy typechecking options.
The `-experimental-skip-all-function-bodies` flag is specified when producing
modules for indexing. These modules are not used for compilation, so it should
be safe to allow `-experimental-lazy-typecheck` and
`-experimental-skip-non-exportable-decls` as well without
`-enable-library-evolution`.

Resolves rdar://128706306
2024-05-24 15:13:31 -07:00
Allan Shortlidge
741a72194e Frontend: Remove -experimental-skip-non-inlinable-function-bodies-is-lazy.
It is no longer needed to work around missing build system support.
2024-05-24 15:13:29 -07:00
Steven Wu
68c755e99c [Caching] Temporarily using llvm style diagnostics in caching
When caching is enabled, using swift style diagnotics can lead to
crashes due to some uninitialized variables. Even more, the swift style
diagnostics is not going to render the same when replay from the cache
since the currect caching diagnostics processor is not capture all
information that is needed to render diagnostis from SwiftSyntax.
Temprarily using llvm style for caching builds.

rdar://127530204
2024-05-22 13:15:08 -07:00
Augusto Noronha
16755e938b Merge pull request #73727 from augusto2112/remove-dep-irgen
Remove dependency of SILFunction in IRGenOptions
2024-05-22 11:18:49 -07:00
Ellie Shin
165ce9c95f Merge pull request #73717 from apple/elsh/override-flags
Override flags that prevent package-cmo if allow-non-resilient-access is enabled
2024-05-21 16:56:16 -07:00
Augusto Noronha
4aec4e7cc4 Remove dependency of SILFunction in IRGenOptions
SILFunction::shouldBePreservedForDebugger checks if some optimizations
are enabled to decide whether a function should be preserved so its
accessible form the debugger or not. Some of these settings used to live
only in IRGenOptions making SILFunction depend on IRGenOptions.
2024-05-21 15:30:15 -07:00
Artem Chikin
31337dd004 Merge pull request #69706 from artemcm/DepScanCPPInterop
[Explicit Module Builds] C++ Interoperability mode fixes
2024-05-20 20:29:17 -04:00
Ellie Shin
84a7c6395c Override flags that prevent package-cmo if allow-non-resilient-access is enabled 2024-05-20 14:13:07 -07:00
artemcm
ec4e0e23aa Allow users to opt-out of implicit Cxx import with -disable-implicit-cxx-module-import 2024-05-20 11:18:45 -07:00
Steven Wu
295c845dd2 Merge pull request #73601 from cachemeifyoucan/eng/PR-127844120
[ScanDependency] Pass crossimport overlay file to swift-frontend
2024-05-20 10:38:04 -07:00
Artem Chikin
bc17581ae6 [Explicit Module Builds] Propagate the C++ Interop mode to interface sub-invocations and dependency scanner 2024-05-20 10:23:10 -07:00
Michael Gottesman
20a3589763 [sending] Enable sending whenever region isolation is enabled and make SE-0430 an upcoming feature.
I also added support for expressing suppressable upcoming features.

rdar://128216574
2024-05-17 19:56:29 -07:00
Michael Gottesman
b780ff6696 [sending] Begin parsing 'sending' while still accepting 'transferring'.
A few things:

1. Internally except for in the parser and the clang importer, we only represent
'sending'. This means that it will be easy to remove 'transferring' once enough
time has passed.

2. I included a warning that suggested to the user to change 'transferring' ->
'sending'.

3. I duplicated the parsing diagnostics for 'sending' so both will still get
different sets of diagnostics for parsing issues... but anywhere below parsing,
I have just changed 'transferring' to 'sending' since transferring isn't
represented at those lower levels.

4. Since SendingArgsAndResults is always enabled when TransferringArgsAndResults
is enabled (NOTE not vis-a-versa), we know that we can always parse sending. So
we import "transferring" as "sending". This means that even if one marks a
function with "transferring", the compiler will guard it behind a
SendingArgsAndResults -D flag and in the imported header print out sending.

rdar://128216574
2024-05-16 21:43:50 -07:00
Tim Kientzle
5b49a04ddc New assertions support
This adds three new assertion macros:
* `ASSERT` - always compiled in, always checked
* `CONDITIONAL_ASSERT` - always compiled in, checked whenever the `-compiler-assertions` flag is provided
* `DEBUG_ASSERT` - only compiled into debug builds, always checked when compiled in  (functionally the same as Standard C `assert`)

The new `-compiler-assertions` flag is recognized by both `swift-frontend` and
`swiftc`.

The goal is to eventually replace every use of `assert` in the compiler with one of the above:
* Most assertions will use `ASSERT` (most assertions should always be present and checked, even in release builds)
* Expensive assertions can use `CONDITIONAL_ASSERT` to be suppressed by default
* A few very expensive and/or brittle assertions can use `DEBUG_ASSERT` to be compiled out of release builds

This should:
* Improve quality by catching errors earlier,
* Accelerate compiler triage and debugging by providing more accurate crash dumps by default, and
* Allow compiler engineers and end users alike to add `-compiler-assertions` to get more accurate failure diagnostics with any compiler
2024-05-16 11:38:00 -07:00
Doug Gregor
359afa89fa Merge pull request #73662 from DougGregor/concurrency-now-with-availability 2024-05-16 06:40:55 -07:00
Doug Gregor
214d3f6980 Remove an old, horrible compatibility hack in the _Concurrency module
The concurrency module was getting an implicit
`-disable-availability-checking` as a workaround from the Swift 5.6
days. Remove it, because it causes problems with the new `Failure`
type in the async for..in loop.

Fixes a back-deployment issue with async algorithms in the
_Concurrency library that use the async for..in loop.
2024-05-15 21:28:14 -07:00
Kavon Farvardin
5ae2f6bd25 CxxInterop: use Unsafe*Pointer for move-only 2024-05-14 17:44:22 -07:00
Steven Wu
cf8187a4fe [ScanDependency] Pass crossimport overlay file to swift-frontend
Teach dependency scanner to pass cross import overlay file to
swift-frontend for main module compilation. This allows swift-frontend
not to repeat the file system search for overlay files when loading
modules.

This also fixes the issue when caching is enabled, the cross import
doesn't work when the first module is a clang module because the module
built with caching using clang include tree does not preserve
DefinitionLoc which is used to inferred the modulemap location for cross
import overlay search.

rdar://127844120
2024-05-14 15:24:35 -07:00
Steven Wu
431f097e7c [Caching] Mark -typecheck action as caching supported
This is a regression causing lots of cached diagnostics tests not
functioning since the cached diagnostics processors are not initialized
for those tests which are supposed to test diagnostics caching.

The regression is caused by the fix that the typecheck module interface
job need to run a typecheck job in the sub-invocation. Now the typecheck
module interface job is correctly setup to avoid diagnostics about
unsupported file system error.
2024-05-13 09:36:12 -07:00
Kshitij Jain
01654fd323 Merge pull request #71775 from jkshtj/main
[Autodiff] Adds part of the Autodiff specific closure-specialization optimization pass
2024-05-10 08:51:01 -07:00
Holly Borla
a7920ce50b [Features] Replace -enable-nonfrozen-enum-exhaustivity-diagnostics with an
upcoming feature.

The bespoke flag still works as a way to enable the `NonfrozenEnumExhaustivity`
upcoming feature. `NonfrozenEnumExhaustivity` is enabled by default in the
Swift 6 language mode as errors, and enabled by default in the Swift 5 language
mode as warnings.
2024-05-06 20:56:20 -07:00
Kshitij
fd609846ae Makes the swift-based closure-spec pass an experimental frontend feature 2024-05-02 09:14:05 -07:00
Dave Lee
e57f70bd4d [Debugging] Add DebugDescriptionMacro experimental feature (#73107)
This removes the leading underscore from the macro.
2024-04-18 17:25:44 -07:00
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