Commit Graph

4565 Commits

Author SHA1 Message Date
Kuba Mracek
9a380212c1 [embedded] Add an interim attr to mark declarations as unavailable in embedded Swift
Implemented as custom parsing logic instead of a proper attribute because we want it to be rewritten at parse time (into nothing in regular Swift mode, and into unconditional unavailable attr in embedded Swift mode), no serialization, printing, etc.
2023-09-10 08:23:31 -07:00
swift-ci
e77b2ee5b0 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-08 18:56:08 -07:00
Pavel Yaskevich
c75aea3654 Merge pull request #68390 from xedin/checked-continuations-for-foreign-callbacks
Provide ability to use CheckedContinuation when suspending for an async ObjC call
2023-09-08 18:52:04 -07:00
Shubham Sandeep Rastogi
585c700965 Merge pull request #68138 from rastogishubham/MCCASSwift
Add driver options to swift to enable MCCAS.
2023-09-08 10:17:10 -07:00
swift-ci
42afa01a39 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-08 08:13:53 -07:00
Alexis Laferrière
0a3ca91275 Merge pull request #68382 from xymus/serial-special-case-here
Serialization: Tagged compilers should rebuild modules from swiftinterface under the resource-dir
2023-09-08 07:56:26 -07:00
Shubham Sandeep Rastogi
3c949028e8 Add driver options to swift to enable MCCAS.
To enable MCCAS, the following driver options have been added

-cas-backend: Enable MCCAS backend in swift, the option
-cache-compile-job must also be used.

-cas-backend-mode=native: Set the CAS Backend mode to emit an object
file after materializing it from the CAS.

-cas-backend-mode=casid: Emit a file with the CASID for the CAS that was
created.

-cas-backend-mode=verify: Verify that the object file created is
identical to the object file materialized from the CAS.

-cas-emit-casid-file: Emit a .casid file next to the object file when
CAS Backend is enabled.
2023-09-08 07:13:57 -07:00
swift-ci
b73bfe4686 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-07 21:14:44 -07:00
Allan Shortlidge
e7d32503af Merge pull request #68384 from tshortli/emit-module-lazy-typecheck-inherited-protocol-printing
ModuleInterface: Fix inheritance clauses in lazily emitted swiftinterfaces
2023-09-07 20:56:36 -07:00
Pavel Yaskevich
b8fb94b73c [Frontend] NFC: Add a flag to enable bridging of completion handlers to checked continuations 2023-09-07 17:35:35 -07:00
swift-ci
6dcf2a4872 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-07 16:36:57 -07:00
Doug Gregor
b7c2cb8a9e Merge pull request #68379 from DougGregor/swift-syntax-multiple-files 2023-09-07 16:20:41 -07:00
Alexis Laferrière
52f2cc381d Serialization: allow rebuilding modules from swiftinterface in release builds
There is some special logic for loading modules from under the
resource-dir. In this case, if there's a swiftmodule next to the
swiftinterface we refuse to rebuild the module from the swiftinterface.
It was designed to catch misconfigurations, either locally if we forget
to rebuild the stdlib from source or at deployement.

It has been causing issues recently with LLDB and other tools. Let's
keep this behavior only for the local scenario by limiting it to
untagged compilers. This restriction aligns well with the strict
compiler tag check for swiftmodule compatibility.
2023-09-07 14:42:34 -07:00
Allan Shortlidge
7c1b150f39 ModuleInterface: Resolve inherited types when computing unsatisfiable conformances.
Previously, unsatisfiable conformances could be omitted from emitted
`.swiftinterface` files in lazy typechecking mode since inherited types might
be unresolved when gathering the conformances.

Adding these test cases also revealed that serialization restrictions needed to
be relaxed in order to accomodate unsatisfiable conformances.
2023-09-07 13:57:39 -07:00
Allan Shortlidge
eee122c093 ModuleInterface: Resolve inherited types when recording indirect conformances.
Previously, indirect public conformances provided by conforming to an internal
protocol could be skipped in a `.swiftinterface` in lazy typechecking mode
since inherited types might not be resolved before collecting the indirect
conformances.
2023-09-07 13:57:39 -07:00
swift-ci
5bb21c1303 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-07 01:14:42 -07:00
Kuba Mracek
25eb997a28 [embedded] Add basics of module serialization, importing and validation in embedded Swift.
- Add a flag to the serialized module (IsEmbeddedSwiftModule)
- Check on import that the mode matches (don't allow importing non-embedded module in embedded mode and vice versa)
- Drop TBD support, it's not expected to work in embedded Swift for now
- Drop auto-linking backdeploy libraries, it's not expected to backdeploy embedded Swift for now
- Drop prespecializations, not expected to work in embedded Swift for now
- Use CMO to serialize everything when emitting an embedded Swift module
- Change SILLinker to deserialize/import everything when importing an embedded Swift module
- Add an IR test for importing modules
- Add a deserialization validation test
2023-09-06 20:06:36 -07:00
swift-ci
f52fc06ac7 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 18:14:46 -07:00
Zoe Carver
74e22dc450 Merge pull request #68244 from zoecarver/embedded-swift 2023-09-06 17:58:39 -07:00
swift-ci
1c2e216cd5 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 15:13:57 -07:00
Steven Wu
f5407533ee Merge pull request #68164 from cachemeifyoucan/eng/PR-swift-caching-option-declare
[Option][Caching] Clean up option caching exclusion list
2023-09-06 14:56:18 -07:00
swift-ci
2b13c6e4b3 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 14:34:53 -07:00
Steven Wu
afc2bab7f9 Merge pull request #67942 from cachemeifyoucan/eng/PR-swift-scan-plugin-cas-support
[SwiftScan][Caching] Add support for plugin CAS for caching
2023-09-06 14:18:42 -07:00
swift-ci
0407c3d3b2 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 13:34:53 -07:00
zoecarver
9f75a262ab [embedded] Error if embedded Swift enables library evolution. 2023-09-06 10:48:17 -07:00
Allan Shortlidge
0dd8f4c492 AST: Introduce abstraction for extension/type decl inheritance clauses.
Wrap the `InheritedEntry` array available on both `ExtensionDecl` and
`TypeDecl` in a new `InheritedTypes` class. This class will provide shared
conveniences for working with inherited type clauses. NFC.
2023-09-06 10:41:57 -07:00
Steven Wu
0f53e7db46 [SwiftScan][Caching] Add support for plugin CAS for caching
Teach libSwiftScan about plugin CAS and add API to create plugin CAS to
use for dependency scanning and cas operations.
2023-09-06 10:36:23 -07:00
Doug Gregor
7287ad00b7 [Diagnostics] Let the swift-syntax formatter handle multiple files itself 2023-09-05 17:57:43 -07:00
swift-ci
3b8132730e Merge remote-tracking branch 'origin/main' into rebranch 2023-09-05 06:54:06 -07:00
Doug Gregor
eb9b736e29 Use SwiftInt consistently 2023-09-04 22:36:16 -07:00
Doug Gregor
9bf512adf0 [Diagnostics] Remove the C++ formatter for the "Swift" diagnostic style
We'll be using the new swift-syntax diagnostic formatter in the near
future, as it is nearly available on all host platforms. So, remove
the C++ formatter that did source-line annotation, falling back to the
"LLVM" style when swift-syntax is not compiled in.
2023-09-04 22:22:17 -07:00
Doug Gregor
c7881fbae2 Fix int/SwiftInt confusion in diagnostic printing code 2023-09-01 23:31:25 -07:00
Doug Gregor
448402c608 [Diagnostics] Free memory associated with printed string 2023-09-01 22:03:09 -07:00
Doug Gregor
8efe6a6b0c [New diagnostics] Don't aggregate across warnings/errors.
The "grouped diagnostics" feature can handle multiple
warnings/errors/remarks in a single grouping, but doing so isn't very
ergonomic for users because the primary warning/error/remark can be
buried in the source file. As a first step toward improving this
situation, always break up groups at a new warning/error/remark.
2023-09-01 16:28:25 -07:00
swift-ci
1582741df2 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-30 21:56:51 -07:00
Michael Gottesman
fa1558a175 [frontend] Add an option called -verify-additional-prefix to add additional check prefixes to the DiagnosticVerifier.
This enables one to use varying prefixes when checking diagnostics with the
DiagnosticVerifier. So for instance, I can make a test work both with and
without send-non-sendable enabled by adding additional prefixes. As an example:

```swift
// RUN: %target-swift-frontend ... -verify-additional-prefix no-sns-
// RUN: %target-swift-frontend ... -verify-additional-prefix sns-

let x = ... // expected-error {{This is always checked no matter what prefixes I added}}
let y = ... // expected-no-sns-error {{This is only checked if send non sendable is disabled}}
let z = ... // expected-sns-error {{This is only checked if send non sendable is enabled}}
let w = ... // expected-no-sns-error {{This is checked for a specific error when sns is disabled...}}
// expected-sns-error @-1 {{and for a different error when sns is enabled}}
```

rdar://114643840
2023-08-30 13:40:17 -07:00
swift-ci
fca0dc0a16 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-29 07:34:13 -07:00
Allan Shortlidge
5186971a02 Frontend: Introduce -experimental-serialize-external-decls-only option.
This option is designed to be used in conjunction with
`-experimental-lazy-typecheck` and `-experimental-skip-all-function-bodies`
when emitting a resilient module. The emitted binary module should contain only
the decls needed by clients and should contain roughly the same contents as it
would if the corresponding swiftinterface were emitted instead and then built.

This functionality is a work in progress. Some parts of the AST may still get
typechecked unnecessarily. Additionally, serialization does not trigger the
appropriate typechecking requests for some ASTs and then fails due to missing
types.

Resolves rdar://114230586
2023-08-28 21:22:20 -07:00
Steven Wu
9ecb17acc2 [Option][Caching] Clean up option caching exclusion list
Systematically declare CacheInvariant options in TableGen file instead
of putting a list in the cache key computation function.
2023-08-28 09:24:10 -07:00
Allan Shortlidge
3a02629be4 Frontend: Make lazy typechecking a TC opt instead of a frontend action. 2023-08-28 08:28:56 -07:00
swift-ci
787a51879c Merge remote-tracking branch 'origin/main' into rebranch 2023-08-25 19:33:11 -07:00
Doug Gregor
339d31fabb [Macros] Add a frontend flag -Rmacro-loading to remark on macro resolution
Macro implementations can come from various locations associated with
different search paths. Add a frontend flag `-Rmacro-loading` to emit
a remark when each macro implementation module is resolved, providing
the kind of macro (shared library, executable, shared library loaded
via the plugin server) and appropriate paths. This allows one to tell
from the build load which macros are used.

Addresses rdar://110780311.
2023-08-25 15:09:49 -07:00
swift-ci
099ba55cfa Merge remote-tracking branch 'origin/main' into rebranch 2023-08-19 09:33:55 -07:00
Allan Shortlidge
b234b79b31 Merge pull request #68021 from tshortli/experimental-lazy-typecheck
Frontend: Introduce -experimental-lazy-typecheck action
2023-08-19 09:30:10 -07:00
swift-ci
8d3034d4a4 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-19 08:33:53 -07:00
Sophia Poirier
aec59f2f9c Merge pull request #67974 from sophiapoirier/global-static-data-race-safety
enforce under strict concurrency that globals and statics be either…
2023-08-19 08:28:02 -07:00
swift-ci
174b6bc00c Merge remote-tracking branch 'origin/main' into rebranch 2023-08-18 19:34:12 -07:00
Allan Shortlidge
54435aca4f Frontend: Introduce -experimental-lazy-typecheck action.
This action is currently just an alias of the `-resolve-imports` action.
However, it's named to more clearly reflect the purpose which is to do the
minimal typechecking needed in order to emit the requested outputs. This mode
is intended to improve performance when emitting `.swiftinterface` and `.tbd`
files.
2023-08-18 16:15:33 -07:00
Zak Kent
2abca625d7 Merge branch 'main' into update-immediate 2023-08-18 16:07:14 -07:00
Artem Chikin
753d54576e Merge pull request #67994 from artemcm/NoPostSerializationOptimizationForExplicitInterface
Enable `StopOptimizationAfterSerialization` SIL Option for explicit `-compile-module-from-interface` tasks
2023-08-18 15:40:28 -07:00