Commit Graph

4788 Commits

Author SHA1 Message Date
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
eeckstein
401a2ac2bc Merge pull request #84704 from eeckstein/closure-specialization
ClosureSpecialization: support for OSSA and a big overhaul
2025-10-07 06:59:08 +02:00
John Hui
d68ca8de1e [Diagnostics] Add -suppress-notes flag
We already have -suppress-warnings and -suppress-remarks; this patch
adds support for suppressing notes too. Doing so is useful for -verify
tests where we don't really care about the emitted notes.
2025-10-06 17:05:57 -07:00
Ryan Mansfield
ba0ce8aea6 Add frontend options to write SIL and LLVM IR as additional compilation output.
This commit adds -sil-output-path and -ir-output-path frontend options that
allow generating SIL and LLVM IR files as supplementary outputs during normal
compilation.

These options can be useful for debugging and analysis tools
workflows that need access to intermediate compilation artifacts
without requiring separate compiler invocations.

Expected behaviour:

Primary File mode:
 - SIL: Generates one .sil file per source file
 - IR: Generates one .ll file per source file

Single-threaded WMO mode:
 - SIL: Generates one .sil file for the entire module
 - IR: Generates one .ll file for the entire module

Multi-threaded WMO mode:
 - SIL: Generates one .sil file for the entire module
 - IR: Generates separate .ll files per source file

File Maps with WMO:
 - Both SIL and IR outputs using first entry's naming, which is
   consistent with the behaviour of other supplementary outputs.

rdar://160297898
2025-10-06 15:45:49 -04:00
Erik Eckstein
8efafc7e3b Optimizer: remove the -experimental-swift-based-closure-specialization option 2025-10-06 12:02:48 +02:00
Henrik G. Olsson
b2ddd689e4 [DiagnosticVerifier] Enable -verify-ignore-unrelated
This enables the previously added -verify-ignore-unrelated flag. When
-verify is used without -verify-ignore-unrelated, diagnostics emitted in
buffers other than the main file and those passed with
-verify-additional-file (except diagnostics emitted at <unknown>:0) will
now result in an error. They were previously ignored. The old behaviour
is still available as opt-in using -verify-ignore-unrelated.
2025-10-04 14:20:01 -07:00
Henrik G. Olsson
e0c65b7c44 [DiagnosticVerifier] Add -verify-ignore-unrelated flag
This adds the implementation required for later changing the default
behaviour of the -verify flag to error when diagnostics are emitted
in buffers other than the main file and files added with
-verify-additional-file. To keep the current behaviour, use the flag
-verify-ignore-unrelated. This flag is added as a no-op so that tests
can start using it before the new behaviour is enabled by default.
2025-10-04 12:40:59 -07:00
Mishal Shah
03a599c5be Merge pull request #84606 from swiftlang/rebranch
Merge clang 21.x rebranch into main
2025-10-02 20:17:05 -07:00
John Hui
e97fa2430b [DiagnosticVerifier] Do not capture 'fatal error encountered' errors (#84640)
When the diagnostic verifier encounters a fatal error, it reports:

    <unknown>:0: error: fatal error encountered while in -verify mode

If we capture this, and fail to match this against an expected-error,
the diagnostic verifier complains:

    <unknown>:0: error: unexpected error produced: fatal error encountered while in -verify mode
    <unknown>:0: error: diagnostic produced elsewhere: fatal error encountered while in -verify mode

The current workaround is to use -verify-ignore-unknown, but that in
turn may mask actual errors coming from unknown source locations.
Ignoring these errors about errors removes the need for that workaround.
2025-10-02 11:14:59 -07:00
Doug Gregor
c4527dc47d Merge pull request #84580 from DougGregor/static-build-configure 2025-09-30 20:47:04 -07:00
Doug Gregor
ae8f9d8234 Add -print-static-build-config to print a static build conformance
Introduce the ability to form a `StaticBuildConfiguration` from
language options. Add a frontend option `-print-static-build-config`
to then print that static build configuration as JSON in a manner that
can be decoded into a `StaticBuildConfiguration`.

Most of the change here is in sinking the bridged ASTContext queries
of language options into a new BridgedLangOptions. The printing of the
static build configuration only has a LangOptions (not an ASTContext),
so this refactoring is required for printing.
2025-09-29 18:42:14 -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
d5a03fa0e4 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-26 22:36:42 -07:00
Erik Eckstein
a322fd9209 Serialization: remove the IS_OSSA flag from the module file header 2025-09-26 08:01:08 +02:00
Erik Eckstein
2f124cf564 Remove the -enable-ossa-modules option.
OSSA modules are enabled by default.
The compiler still accepts this option but it has no effect.
2025-09-26 08:01:08 +02:00
swift-ci
0e71bd5b51 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-25 14:16:45 -07:00
Artem Chikin
fb30e072f1 Merge pull request #84475 from artemcm/NoCanImportFailOnWrongArch
Do not fail the build on only finding incompatible-architecture modules on `canImport` queries
2025-09-25 17:01:38 -04:00
swift-ci
131f68b779 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-25 13:58:07 -07:00
Allan Shortlidge
fba664c082 Revert "Frontend: Require explicit language mode when emitting swiftinterfaces."
This reverts commit 9067051c29.
2025-09-25 08:02:18 -07:00
swift-ci
e04ee0fc2d Merge remote-tracking branch 'origin/main' into rebranch 2025-09-23 22:54:52 -07:00
Kavon Farvardin
a44bf30141 Merge pull request #84476 from kavon/manual-ownership/usability-fixes-1
Usability improvements for ManualOwnership (aka "explicit copies mode")
2025-09-23 22:47:22 -07:00
Kavon Farvardin
c20ed75d19 ManualOwnership: imply MandatoryCopyPropagation
The usability of the feature depends on running
MandatoryCopyProp, which is in development.
2025-09-23 16:35:08 -07:00
swift-ci
bf0e4bb4d1 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-23 15:58:43 -07:00
Artem Chikin
391a18d56a Merge pull request #84443 from artemcm/RestrictEmbeddedToBinarySwift
[Dependency Scanning] Avoid querying Swift Overlay for underlying module
2025-09-23 18:41:47 -04:00
swift-ci
e35756ef85 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-23 15:38:03 -07:00
Artem Chikin
c73869e479 Do not fail the build on only finding incompatible-architecture modules on 'canImport'
This change refactors the module loaders to explicitly take a parameter indicating whether or not the loader is handling a 'canImport' query, in order to avoid emitting an error when finding a dependency Swift binary module with only imcompatible architecture variants present.

Resolves rdar://161175498
2025-09-23 15:26:02 -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
e183e45142 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-23 10:57:04 -07:00
Henrik G. Olsson
c82e85d065 Merge pull request #84336 from hnrklssn/verify-macros
[Frontend] Add support for named target buffer in -verify expected lines
2025-09-23 10:28:07 -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
Artem Chikin
7803fe2eef [Embedded] Restrict embedded compilation mode to load serialized binary modules only 2025-09-22 14:14:05 -07:00
swift-ci
2fffb15836 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-22 06:31:59 -07:00
Konrad `ktoso` Malawski
6f4c26f29a Merge pull request #84384 from ktoso/wip-distributed-red-conf 2025-09-22 21:00:26 +09:00
swift-ci
2deb2f9a87 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 22:17:53 -07:00
Kavon Farvardin
889baf7f2c Merge pull request #84411 from kavon/copyprop-onone
sil: provide ability to run CopyPropagation in -Onone
2025-09-19 22:09:59 -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
30bdb6b37a [Serialization] Don't serialize an internally-imported bridging header
Internally-imported bridging headers must not leak outside of the Swift
module. Don't serialize their contents, and make sure we can still
import the module even if the bridging header has been removed.
2025-09-19 16:49:22 -07:00
Doug Gregor
b9f00ef923 Warn about the use of internal bridging headers without library evolution
It's very, very easy to make a mistake that will cause broken
serialized modules. Until that's no longer true, at least tell folks
that they are heading into uncharted waters, as we do with
`@_implementationOnly` imports.
2025-09-19 16:49:22 -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
Doug Gregor
ffa6d65f12 [Options] Make -import-bridging-header the canonical spelling instead of -import-objc-header
This command-line option hasn't been Objective-C specific ever, really.
Make the language-independent spelling the primary one to make that
more obvious.
2025-09-19 16:49:11 -07:00
Kavon Farvardin
4a943d464d sil: provide ability to run CopyPropagation in -Onone
This does not enable it by default. Use either of the flags:

```
-enable-copy-propagation
-enable-copy-propagation=always
```

to enable it in -Onone. The previous frontend flag
`-enable-copy-propagation=true` has been renamed to
`-enable-copy-propagation=optimizing`, which is currently default.

rdar://107610971
2025-09-19 16:23:19 -07:00
Henrik G. Olsson
c5256ff341 Fix continue statements incorrectly changed to returns
When this function was extracted from a for loop, continue was mapped to
return, but these nested continues should remain.
2025-09-19 14:20:04 -07:00
swift-ci
647f66ad2b Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 14:18:04 -07:00
Henrik G. Olsson
5422c8d284 Fix bug where column is specified for own line
When the syntax `expected-error@:42{{}}` was used, this would
accidentally trigger "absolute line" mode, despite not specifying a
line, resulting in the target line always being line 0.
2025-09-19 12:43:07 -07:00
Konrad Malawski
1ea4e914e3 Simplify the check; conforming to (Distributed)Actor is not right in any case 2025-09-19 10:50:23 +09:00