Commit Graph

1878 Commits

Author SHA1 Message Date
Ben Barham
03ca9ea0a5 [SourceKit] Remove diagnostics path calculation
The diagnostic group documentation now point to the swift.org URL rather
than the toolchain path, so it no longer needs to be passed all the way
through sourcekitd.

Resolves rdar://151500502.

(cherry picked from commit 381684a389)
2025-05-19 14:48:46 -07:00
Pavel Yaskevich
ee3aca2ef3 Merge pull request #81518 from xedin/rdar-148124973-6.2
[6.2][Frontend] Add a way to print features supported by the compiler
2025-05-15 09:46:15 -07:00
Pavel Yaskevich
de6ef08d71 [Feature] Switch migration postfix from :adoption to :migrate
(cherry picked from commit 1ba077d922)
2025-05-14 20:28:46 -07:00
Pavel Yaskevich
61c8e70c66 [Feature] Rename Feature APIs from adoption to migration
(cherry picked from commit 085078dd8a)
2025-05-14 20:28:46 -07:00
Michael Gottesman
e92e9dff0c Make Feature a struct enum so we can put methods on it.
Just noticed this as I was looking at making other changes.

(cherry picked from commit 3ff9463957)
2025-05-14 16:07:04 -07:00
Pavel Yaskevich
2bf00077e4 [stdlib] SE-0472: Rename Task and*TaskGroup APIs to match the proposal
`Task.startSynchronously` -> `Task.immediate`
`*TaskGroup.startTaskSynchronously{UnlessCancelled}` -> `*TaskGroup.addImmediateTask{UnlessCancelled}`

(cherry picked from commit 001eab867d)
2025-05-13 20:11:28 -07:00
Konrad 'ktoso' Malawski
910bc1a1a3 [Concurrency] Improve in order synchronous enqueue of startSynchronously
Previously there was still a sneaky hop which caused ordering issues.
This introduced a specific test startSynchronously_order which checks
that the task enqueues indeed are "immediate" and cleans up how we
handle this.

This also prepares for the being discussed in SE review direction of
this API that it SHOULD be ALLOWED to actually hop and NOT be
synchronous at all IF the isolation is specified on the closure and is
DIFFERENT than the callers dynamic isolation.

This effectively implements "synchronously run right now if dynamically
on the exact isolation as requested by the closure; otherwise enqueue
the task as usual".

resolves rdar://149284186
cc @drexin

(cherry picked from commit a24a28c217)
2025-05-13 20:10:35 -07:00
Konrad 'ktoso' Malawski
25413d2ef4 [embedded][Concurrency] Further refine C-api boundary for isIsolating... 2025-04-29 22:29:54 +09:00
Anthony Latsis
d14a85e380 Merge pull request #80458 from AnthonyLatsis/hildoceras
DiagnosticEngine: Always favor the category of a wrapped diagnostic
2025-04-02 11:26:28 +01:00
Anthony Latsis
148c1773a5 DiagnosticEngine: Always favor the category of a wrapped diagnostic 2025-04-02 06:45:15 +01:00
Allan Shortlidge
303f7d8452 AST: Build scopes for if #available queries on custom availability domains.
Resolves rdar://138441298 and rdar://138441307.
2025-04-01 09:03:41 -07:00
Allan Shortlidge
e943c4bffd AST: Build statement condition availability scopes using AvailabilityContext.
Preparation for building availability scopes for `if #available` statements
that query non-platform availability domains.
2025-04-01 07:46:46 -07:00
Doug Gregor
92c16b2ce0 Test updates for change to diagnostic group printing 2025-03-29 18:18:31 -07:00
Anthony Latsis
a95785c5b2 Merge pull request #80260 from AnthonyLatsis/eutrema-japonicum
DiagnosticEngine: Print the ID of the wrapped, not wrapper, diagnostic
2025-03-25 23:14:43 +00:00
Anthony Latsis
9bfc1635dd [NFC] unittests: Tidy up some DiagnosticEngine tests 2025-03-25 02:25:42 +00:00
Anthony Latsis
77e673a723 DiagnosticEngine: Print the ID of the wrapped, not wrapper, diagnostic 2025-03-25 02:25:39 +00:00
Allan Shortlidge
592b70f00f AST: Fix AvailabilityContext platform range for certain targets.
https://github.com/swiftlang/swift/pull/79807 caused a regression in which
`AvailabilityContext` stopped tracking the available version range for the
active platform domain for certain platforms. Fix this by reverting to checking
`AvailabilityDomain::isActive()` to determine when a given platform
`AvailabilityDomain` represents the target platform. The compiler's existing
mapping from target triple to platform domain is incomplete and it's not clear
to me whether fixing that could cause other regressions.

Resolves rdar://147413616.
2025-03-20 16:26:54 -07:00
Allan Shortlidge
7ae3a86d9b AST: Introduce "root" availability domains.
A root availability domain is a direct descendant of the universal availability
domain.
2025-03-17 22:09:28 -07:00
Ben Barham
aca35a0d3d [Test] Disable flakey cursor info cancellation
The exact cause of this is a mystery to me - each test case should be
finished (and thus any ASTs fully built) before the next runs/we exit.

But one of the recent failures contained a stacktrace:
```
...
20 [ra] 0x0000aaaad9d182f0 llvm::opt::OptTable::internalParseOneArg(llvm::opt::ArgList const&, unsigned int&, std::function<bool (llvm::opt::Option const&)>) const + 127 in SourceKitSwiftLangTests
21 [ra] 0x0000aaaad9d188d0 llvm::opt::OptTable::internalParseArgs(llvm::ArrayRef<char const*>, unsigned int&, unsigned int&, std::function<bool (llvm::opt::Option const&)>) const + 303 in SourceKitSwiftLangTests
22 [ra] 0x0000aaaad9d1877c llvm::opt::OptTable::ParseArgs(llvm::ArrayRef<char const*>, unsigned int&, unsigned int&, llvm::opt::Visibility) const + 47 in SourceKitSwiftLangTests
23 [ra] 0x0000aaaad6fad0d0 getLibcFileMapping[abi:cxx11](swift::ASTContext&, llvm::StringRef, std::optional<llvm::ArrayRef<llvm::StringRef> >, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> const&, bool) + 311 in SourceKitSwiftLangTests
24 [ra] 0x0000aaaad6fab304 swift::getClangInvocationFileMapping(swift::ASTContext&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, bool) + 895 in SourceKitSwiftLangTests
25 [ra] 0x0000aaaad6f4dcac swift::ClangImporter::create(swift::ASTContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, swift::DependencyTracker*, swift::DWARFImporterDelegate*, bool) + 587 in SourceKitSwiftLangTests
26 [ra] 0x0000aaaad5ba07ac swift::CompilerInstance::setUpModuleLoaders() + 531 in SourceKitSwiftLangTests
27 [ra] 0x0000aaaad5ba0530 swift::CompilerInstance::setUpASTContextIfNeeded() + 447 in SourceKitSwiftLangTests
28 [ra] 0x0000aaaad5ba269c swift::CompilerInstance::setup(swift::CompilerInvocation const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, llvm::ArrayRef<char const*>) + 231 in SourceKitSwiftLangTests
29 [ra] 0x0000aaaad593d634 void SourceKit::WorkQueue::DispatchData::callAndDelete<(anonymous namespace)::ASTBuildOperation::schedule(SourceKit::WorkQueue)::$_11>(void*) + 2155 in SourceKitSwiftLangTests
30 [ra] 0x0000aaaad597c2fc executeBlock(void*) + 27 in SourceKitSwiftLangTests
31 [ra] 0x0000aaaad597c330 void* llvm::thread::ThreadProxy<std::tuple<void (*)(void*), void*> >(void*) + 27 in SourceKitSwiftLangTests
32 [ra] 0x0000ffffab37595c <unknown> in libc.so.6
```

So the assertion above clearly isn't true - we are definitely still
building an AST on exit here.

Regardless, this test is not worth CI failing as often as it is. Let's
disable it for now while we look into the cause.
2025-03-14 13:18:56 -07:00
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