Commit Graph

1859 Commits

Author SHA1 Message Date
Slava Pestov
4c60e036ac Merge pull request #79882 from slavapestov/sizeof-constraint
Sema: Optimize Constraint layout to save 24 bytes
2025-03-11 14:30:44 -04:00
Anthony Latsis
b102c986aa [NFC] Basic: Use scoped enum for feature states
To prevent unexpected implicit conversions to integral types.
2025-03-11 01:14:39 +00:00
Konrad `ktoso` Malawski
e056c63c89 [Concurrency] Implement isIsolatingCurrentContext requirement and mode (#79788) 2025-03-11 09:48:38 +09:00
Slava Pestov
83118a73ed Sema: Shave another 8 bytes off of Constraint 2025-03-10 14:53:48 -04:00
Anthony Latsis
5d92f7953c Merge pull request #79792 from AnthonyLatsis/danaus-plexippus-2
Introduce adoption mode for Swift features (take 2)
2025-03-07 19:47:44 +00:00
Allan Shortlidge
77d18a87ea Merge pull request #79784 from tshortli/optimize-version-range-layout
AST: Optimize the layout of `AvailabilityRange`
2025-03-05 12:10:29 -08:00
Steven Wu
c5278f5801 Merge pull request #79779 from cachemeifyoucan/eng/PR-146155049
[Caching] Mark `-emit-module-source-info-path` as CacheInvariant
2025-03-05 08:15:38 -08:00
Anthony Latsis
5c373a5074 [NFC] unittests: Use an experimental feature that is always available 2025-03-05 15:46:09 +00:00
Anthony Latsis
c17226dacc [NFC] unittests: Link Frontend tests with swiftAST to work around dep cycle 2025-03-05 15:45:41 +00:00
Anthony Latsis
6a3903bb53 Revert "Revert "Introduce adoption mode for Swift features""
This reverts commit 393c59c078.
2025-03-05 15:21:01 +00:00
Allan Shortlidge
cad1ee75d5 AST: Optimize the layout of AvailabilityRange.
`AvailabilityRange` is now being used as a currency type in more of the
compiler, and some of those uses are in permanent `ASTContext` allocations. The
class wraps the `VersionRange` utility, which is itself a wrapper around
`llvm::VersionTuple` with some additional storage for representing sentinel
values. Even though the two sentinel values can be be represented with just a
single bit of additional storage on top of the 16 bytes required to represent
`VersionTuple`, because of alignment requirements the sentinel values end up
bloating the layout of `VersionRange` by many bytes.

To make `AvailabilityRange` and `VersionRange` more efficient to store, we can
instead reserve two unlikely `llvm::VersionTuple` bit patterns as the sentinel
values instead. The values chosen are the same ones LLVM uses to represent
version tuple tombstones and empty keys in a `DenseMap`.
2025-03-05 07:15:15 -08:00
Allan Shortlidge
6eab842e7a Merge pull request #79777 from tshortli/potential-unavailability-diagnostics
AST/Sema: Decouple potential unavailability diagnostics from platform version
2025-03-05 00:35:23 -08:00
Allan Shortlidge
b64df7384e AST: Simplify AvailabilityRange construction.
Introduce a constructor that takes an `llvm::VersionTuple` directly, instead of
needing to spell out `VersionRange::allGTE(<tuple>)` which is unnecessarily
verbose.
2025-03-04 19:41:04 -08:00
Rintaro Ishizaki
393c59c078 Revert "Introduce adoption mode for Swift features" 2025-03-04 19:13:05 -08:00
Steven Wu
ae69713639 [Caching] Mark -emit-module-source-info-path as CacheInvariant
For the options that specifies the output, it should be cache invariant.
Fix the one remaining option that is not correctly labelled and add an
unittest to make sure all the options with output path naming convertion
are correctly marked as CacheInvariant.

rdar://146155049
2025-03-04 16:20:26 -08:00
Anthony Latsis
0b542fc5e8 Basic: Define ExistentialAny as supporting adoption mode 2025-03-04 13:43:28 +00:00
Anthony Latsis
2771f36ced LangOptions: Refactor feature state and API to account for adoption mode 2025-03-04 13:43:28 +00:00
Anthony Latsis
8dab67bcee Basic: Adjust feature macros for adoption mode 2025-03-04 13:43:28 +00:00
Anthony Latsis
2abf67872c Frontend: Parse a feature mode specifier 2025-03-04 13:43:28 +00:00
Anthony Latsis
f0cfc0ba55 [NFC] Add unit tests for feature option parsing 2025-03-04 13:43:25 +00:00
Allan Shortlidge
27373ec520 AST: Relax containment for Swift, PackageDescription, and Embedded domains.
Now that `AvailabilityContext` supports multiple unavailable domains, it's no
longer necessary to have a total ordering amongst the Swift,
PackageDescription, and Embedded availability domains.
2025-02-28 19:09:34 -08:00
Konrad `ktoso` Malawski
f55964df26 [Concurrency] Initial steps for startSynchronously for Task (#79608)
* [Concurrency] Initial steps for startSynchronously for Task

* [Concurrency] Rename to _startSynchronously while in development

* [Concurrency] StartSynchronously special executor to avoid switching

* startSynchronously bring back more info output

* [Concurrency] startSynchronously with more custom executor tests

* add missing ABI additions to test for x86

* [Concurrency] gyb generate _startSynchronously

* [Concurrency] %import dispatch for Linux startSynchronously test

* [Concurrency] Add TaskGroup.startTaskSynchronously funcs

* [Concurrency] DispatchSerialQueue does not exist on linux still
2025-02-27 02:34:33 -08:00
Konrad `ktoso` Malawski
e8668684a1 Merge pull request #79411 from amartini51/typo_144059094
Remove double word ("a a" and "the the")
2025-02-20 13:05:06 +09:00
Alex Hoppen
248d1f3036 Merge pull request #79495 from ahoppen/disable-CursorInfoMustWaitDueTokenRace
[test] Disable `CursorInfoTest.CursorInfoMustWaitDueTokenRace`
2025-02-19 18:26:12 -08:00
Alex Hoppen
46ee1b1ad2 [test] Disable CursorInfoTest.CursorInfoMustWaitDueTokenRace
We keep seeing nondeterministic failures of this test due to rdar://88652757. Disable it for now.
2025-02-19 13:03:47 -08:00
Alex Martini
633f101e0a Fix double 'the the' in various places 2025-02-14 17:27:51 -08:00
Pavel Yaskevich
81b7b447bc Merge pull request #79253 from xedin/fix-use-dc-for-constructor-calls
[ConstraintSystem] Store declaration context in which application constraint occurs
2025-02-10 15:10:13 -08:00
Pavel Yaskevich
23ace7d770 [ConstraintSystem] Store declaration context in which application occurs in ApplicableFunction constraint
This is required because `ApplicableFunction` constraint can
inject member reference constraints that require a declaration
context.

For example, `_ = { Double(...) }` would now produce a disjunction
for `Double.init` where overload choice declaration contexts point
to the closure instead of the enclosing context.

This addresses a long-standing FIXME in `simplifyApplicableFnConstraint`
and helps with disjunction optimizer because its correctness depends on
correct identification of declaration contexts where applications happen.
2025-02-09 15:46:44 -08:00
Pavel Yaskevich
d24f22ec54 [ConstraintSystem] Refactor spots that create ApplicationFunction directly
This is required to make it easier to add "use dc" to the application.
2025-02-09 14:03:43 -08:00
Allan Shortlidge
fa44b9e0b4 AST: Introduce some AvailabilityDomain conveniences.
One to get the active domain for the compilation target and another to get the
ABI compatibility domain for a given domain. The ABI compatibility domain will
be needed for queries that compute whether an unavailable declaration is still
reachable at runtime.

NFC.
2025-02-09 09:39:33 -08:00
Allan Shortlidge
d04fe1144c Tests: Cover more containment queries in AvailabilityDomain tests. 2025-02-09 09:39:33 -08:00
Allan Shortlidge
ddb5f23306 AST: Add AvailabilityContext::containsUnavailableDomain().
Replaces AvailabilityContext::getUnavailableDomain().
2025-02-06 09:50:07 -08:00
Allan Shortlidge
889bc3138d unittests: Add tests for AvailabilityContext. 2025-02-06 09:50:07 -08:00
Allan Shortlidge
cee7fea597 unittests: Add missing license info to AvailabilityDomainTests.cpp. 2025-02-06 09:50:07 -08:00
Saleem Abdulrasool
0174528f81 stdlib: fix the problem swept under the rug in 58a97f1603
The `-Winvalid-offsetof` warning is valid in this case. `offsetof` is
being applied to types with a non-standard layout. The layout of this
type is undefined by the specification. There is no guarantee that the
type layout is uniform across all ABIs. It is not possible to portably
compute the offset statically, especially efficiently.

Sink this check into a unit test to avoid performing this test at
runtime. In order to do this in the standard library, we would need to
do this check through a global constructor.
2025-02-03 09:25:06 -08:00
Slava Pestov
f35dd66b77 Revert "Sema: Don't generate OneWayEqual constraints for pattern bindings"
This reverts commit 5071e96a78.
2025-02-02 00:43:15 -05:00
Alastair Houghton
ab8e561583 Merge pull request #78516 from al45tair/eng/PR-124913332
[Backtracing] Implement API per SE-0419
2025-01-28 10:48:33 +00:00
Allan Shortlidge
b8c4298a07 AST: Introduce AvailabilityDomain::contains().
This operation describes the partial ordering with which Availability domains
form a lattice.

As a temporary measure, a containment ordering needs to be specified for the
Swift language, Embedded, and Package Description domains. Without this
ordering, there won't be a way for AvailabilityContext to preserve the
invariant that the unavailable domain of a child context contains the
unavailable domain for the parent. However, once AvailabilityContext is
refactored to represent the status of multiple availability domains
simultaneously, the ordering of these domains relative to each other can be
relaxed.

NFC.
2025-01-22 06:40:10 -08:00
Allan Shortlidge
ee357df21e unittests: VersionRange tests gardening.
Fix test naming and make includes more specific. NFC.
2025-01-20 18:27:45 -08:00
Alastair Houghton
760cc57bef [Backtracing] Rename _Backtracing to Runtime.
Move the backtracing code into a new Runtime module.  This means renaming
the Swift Runtime's CMake target because otherwise there will be a name
clash.

rdar://124913332
2025-01-17 10:09:36 +00:00
Slava Pestov
d1d2411bf3 Merge pull request #78267 from slavapestov/incremental-bindings-part-0
Sema: Some small cleanups in CSBindings.cpp and related code
2025-01-16 09:03:32 -05:00
Anthony Latsis
99c3802e02 Merge pull request #78669 from AnthonyLatsis/andromeda
[NFC] Add some unit tests for diagnostic behaviors
2025-01-16 06:30:56 +00:00
Slava Pestov
1aff26eaa6 Sema: Store BindingSet inside the ConstraintGraphNode
Building the DenseMap in determineBestBindings() is extremely
expensive.

Also rename getCurrentBindings() to getPotentialBindings().
2025-01-15 22:30:32 -05:00
Anthony Latsis
77ddc28167 [NFC] Add some unit tests for diagnostic behaviors 2025-01-15 23:23:50 +00:00
Anthony Latsis
29626c4427 [NFC] Diag: Rename error_in_future_swift_version wrappers
Be clear that these are about language mode.
2025-01-15 23:14:08 +00:00
Alex Hoppen
e2235e201c Merge pull request #78421 from ahoppen/add-sourcekit-plugin
[SourceKit] Add mechanism to load plugins for request handling into SourceKit
2025-01-15 12:42:10 -08:00
Anthony Latsis
901d566e78 DiagnosticEngine: Fix diagnostic groups behavior for wrapped diagnostics 2025-01-07 20:29:07 +00:00
Slava Pestov
2d17294d73 Merge pull request #78301 from slavapestov/remove-one-way-constraints
Sema: Remove ConstraintKind::OneWayBindParam and ConstraintKind::OneWayEqual
2025-01-05 10:38:14 -05:00
Anthony Latsis
a6e5e19512 Sema: Minor adjustment to BindingSet dumping
Shorten some of the keys and format them consistently as sentence
fragments rather than identifiers.
2025-01-04 11:27:54 +00:00
Alex Hoppen
b6c94aecc3 [SourceKit] Add mechanism to load plugins for request handling into SourceKit
This allows us to load plugins into the sourcekitd service to handle requests (currently only used for code completion). This allows us to implement parts of sourcekitd in Swift and outside of the compiler repository, making it easier to iterated on them because the compiler doesn’t need to be rebuilt.
2025-01-03 15:24:52 +01:00