Commit Graph

68066 Commits

Author SHA1 Message Date
Ben Barham
73d9f5b843 [SourceKit] Remove OptimizeForIDE global configuration
Have SourceKit return locations for symbols outside of the current
module as well. Callsites of location and comment information should
explicitly disable retrieving serialized information where performance
is a concern.

Resolves rdar://75582627
2021-05-01 11:37:23 +10:00
Ben Barham
bfb9205c7c [Serialization] Add warning when .swiftsourceinfo is malformed
Output a warning rather than ignoring a malformed .swiftsourceinfo
completely.

Resolves rdar://77350048
2021-05-01 11:31:24 +10:00
Konrad `ktoso` Malawski
6094f73487 [TaskLocal] remove commented out code 2021-05-01 10:04:00 +09:00
Alexis Laferrière
71a48def6f Merge pull request #37191 from adrian-prantl/twice-the-pointers
Update the correct size of Builting.Executor, it is now 2 pointers.
2021-04-30 17:20:04 -07:00
Adrian Prantl
a6304c5168 Update the correct size of Builting.Executor, it is now 2 pointers.
Fixes an assertion while building the Concurrency module.
2021-04-30 17:08:35 -07:00
Kavon Farvardin
c5ec5bf5b1 fix feature guards in swiftinterface for eff. props 2021-04-30 17:07:18 -07:00
Ben Barham
828d12764c [SourceKit/CursorInfo] Add locations for external files to result
.swiftsourceinfo files contain the serialized location for declarations.
Use this when outputting locations in cursor info so that clients need
not perform an extra index lookup for external modules.
2021-05-01 09:38:58 +10:00
Ben Barham
e9dcc67987 [Frontend] Attach comments to decls when emitting .swiftsourceinfo
.swiftsourceinfo contains comment ranges, so parsing should attach
comments when it is being emitted. Generally this turned out to be fine
because .swiftdoc is usually output as well, but when calling
swift-frontend directly in tests that isn't necessarily the case.
2021-05-01 09:35:38 +10:00
Hamish Knight
fba9d8342f Merge pull request #37174 from hamishknight/off-the-chain
[Refactoring] Unwrap optional chains in async transform
2021-04-30 23:45:38 +01:00
Xi Ge
c7b383c1e7 Merge pull request #37177 from nkcsgexi/73992299-1
ModuleInterface/Serialization: allow library authors to define a custom module version number
2021-04-30 14:43:16 -07:00
Alex Hoppen
36f1c34aa6 Merge pull request #37110 from ahoppen/pr/convert-completion-handler
[Refactoring] Convert completion handler when converting function to async
2021-04-30 23:17:58 +02:00
Alex Hoppen
e7d56037e8 Merge pull request #37133 from ahoppen/pr/serialize-text-module-symbolgraph
[SymbolGraph] Fix crasher when retrieving cursor info of method defined in ObjC
2021-04-30 23:13:15 +02:00
Arnold Schwaighofer
8699c229e6 Check the callee for async'ness 2021-04-30 13:54:47 -07:00
Erik Eckstein
bd5d4276cd SILCombine: fix keypath optimization with optional chaining and classes
For optional chaining a swift_enum is created.
If the sub-projection is ending a begin_access in the some-branch, it also needs to be ended in the none-branch.

Fixes a compiler crash and/or a miscompile.

https://bugs.swift.org/browse/SR-14534
rdar://77224220
2021-04-30 21:47:42 +02:00
Arnold Schwaighofer
0edbca04bf IRGen: Don't ignore the error parameter in some async functions
Calls that emit the result to memory follow a different path that we
missed to update with error handling code.

rdar://76599021
2021-04-30 12:22:50 -07:00
swift-ci
1e544b095f Merge pull request #37176 from DougGregor/remove-debug-dumps 2021-04-30 12:05:21 -07:00
John McCall
cc2863c136 Merge pull request #36878 from rjmccall/custom-executors
Introduce basic support for custom executors
2021-04-30 13:54:02 -04:00
Xi Ge
01800ffc73 Remove empty line. NFC 2021-04-30 10:21:33 -07:00
Xi Ge
043d492c65 Merge branch 'main' into 73992299-1 2021-04-30 10:19:57 -07:00
Argyrios Kyrtzidis
25c366d8c7 Merge pull request #37170 from hamishknight/take-two
Mark imported @completionHandlerAsync attrs as implicit
2021-04-30 10:18:08 -07:00
Xi Ge
fe5c7ef995 ModuleInterface/Serialization: allow library authors to define a custom module version number
This allows library authors to pass down a project version number so that library users can conditionally
import that library based on the available version in the search paths.

Needed for rdar://73992299
2021-04-30 10:00:45 -07:00
Doug Gregor
106002cdfc Merge pull request #37168 from DougGregor/async-import-mirroring
[Clang importer] Fix mirroring of protocol decls for 'async' imports.
2021-04-30 09:49:29 -07:00
Doug Gregor
8c180498e0 Remove stray debugging statements 2021-04-30 09:21:55 -07:00
Slava Pestov
7a15b7a453 Merge pull request #37157 from slavapestov/gsb-pre-cleanups-redundant-requirements-rewrite
GSB: Preliminary cleanups before redundant requirement algorithm rewrite
2021-04-30 10:19:18 -04:00
Hamish Knight
07cdc2029e [Refactoring] Unwrap optional chains in async transform
Remove an optional chain of a success parameter,
as it will no longer be optional, similar to how
we remove a force unwrap.

Note that while this is a locally valid transform
within the optional chain, e.g `foo?.x` -> `foo.x`,
it may change the type of the overall chain, which
could cause errors elsewhere in the code. However
this is generally more useful to the user than
just leaving `foo` as a placeholder. Note this is
only the case when no other optionals are involved
in the chain, e.g `foo?.x?.y` -> `foo.x?.y` is
completely valid.

Resolves rdar://74014826.
2021-04-30 14:34:31 +01:00
Alex Hoppen
b2378a401e [Refactoring] Convert completion handler when converting function to async
Convert function to async currently only adds "async" to the function and runs the convert call refactoring on the body.

This was intentional, but it turns out to be somewhat confusing. Instead, run the same refactoring as the add async alternative refactoring but just replace rather than add.

Resolves rdar://77103049
2021-04-30 12:53:22 +02:00
Hamish Knight
7e4b66e071 Merge pull request #37131 from hamishknight/out-of-the-void
[Refactoring] Improve Void handling for async conversion
2021-04-30 11:27:30 +01:00
Hamish Knight
fe3dbc2fd4 Fix typo in @completionHandlerAsync printing 2021-04-30 11:14:51 +01:00
Hamish Knight
f439275380 Mark imported @completionHandlerAsync attrs as implicit
Mark imported `@completionHandlerAsync` attrs as
implicit, which avoids printing them in generated
interfaces. And for the sake of completion,
serialize the implicit bit in case it's used
elsewhere in the future.

To make sure we continue to print
`@completionHandlerAsync` attributes explicitly
written by the user in Swift, add a SourceKit
interface test.

Resolves rdar://76685011
2021-04-30 11:14:50 +01:00
swift-ci
39c80eea5b Merge pull request #37164 from DougGregor/actor-class-descriptor-metadata 2021-04-30 02:22:03 -07:00
swift-ci
e152c14c0a Merge pull request #37162 from DougGregor/spawn-let 2021-04-30 02:19:16 -07:00
Alex Hoppen
9def05370b Merge pull request #37128 from ahoppen/pr/crash-invalid-extenshion-symbol-graph
[SymbolGraph] Fix a crash for member in invalid extension
2021-04-30 10:27:22 +02:00
Doug Gregor
bf30b41e5b [Clang importer] Fix mirroring of protocol decls for 'async' imports.
The de-duplication checks to preventing redundant mirroring of protocol
declarations failed to consider that a given method could be
implemented as both 'async' and non-'async' declarations, and
therefore would fail to mirror the 'async' form. Account for this
distinction.

Fixes rdar://76799297.
2021-04-30 01:05:03 -07:00
John McCall
565198ebe3 Default actors carry a null witness-table pointer in Builtin.Executor.
Previously, they were storing a low-bit flag that indicated that they
were a default actor.  Using an extra inhabitant frees up the low bit
for future use without being conspicuously more expensive to check.
2021-04-30 03:11:56 -04:00
John McCall
ec5215bf4f Remove the implicit nil inhabitant of Builtin.Executor,
and traffic in Optional<Builtin.Executor> in various places.
2021-04-30 03:11:56 -04:00
John McCall
186c53000d Introduce basic support for custom executors.
- Introduce an UnownedSerialExecutor type into the concurrency library.
- Create a SerialExecutor protocol which allows an executor type to
  change how it executes jobs.
- Add an unownedExecutor requirement to the Actor protocol.
- Change the ABI for ExecutorRef so that it stores a SerialExecutor
  witness table pointer in the implementation field.  This effectively
  makes ExecutorRef an `unowned(unsafe) SerialExecutor`, except that
  default actors are represented without a witness table pointer (just
  a bit-pattern).
- Synthesize the unownedExecutor method for default actors (i.e. actors
  that don't provide an unownedExecutor property).
- Make synthesized unownedExecutor properties `final`, and give them
  a semantics attribute specifying that they're for default actors.
- Split `Builtin.buildSerialExecutorRef` into a few more precise
  builtins.  We're not using the main-actor one yet, though.

Pitch thread:
  https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425
2021-04-30 03:11:56 -04:00
John McCall
769c2e76f1 Add a utility to clone an @available attribute. 2021-04-30 03:11:43 -04:00
Doug Gregor
7a80c338a4 [ABI] Set a bit in the class context descriptor for actor types.
Allow runtime metadata queries to determine if a "class" (in the
runtime) is actually an actor by adding a bit to the class context
descriptor's type-specific kind flags.

Implements rdar://77073762.
2021-04-30 00:03:55 -07:00
Doug Gregor
1fa2d1656d [Concurrency] Don't complain about interpolation variables being mutated.
Implicitly-generated interpolation variables are mutated within the
autoclosures created by a `spawn let`. Don't complain about them being
concurrently accessed, because they aren't.

Fixes rdar://76020473.
2021-04-29 23:32:56 -07:00
Doug Gregor
41f42fabbf [Concurrency] Resyntax 'async let' as 'spawn let'.
This helps track the proposal.
2021-04-29 23:28:16 -07:00
swift-ci
7be0429830 Merge pull request #37156 from kavon/eff-prop-extension-interface-bug 2021-04-29 23:16:15 -07:00
Doug Gregor
5d8174da57 [Concurrency] Introduce spawn let 2021-04-29 22:42:40 -07:00
eeckstein
776c8edaab Merge pull request #37127 from eeckstein/fix-deadobject-elim
DeadObjectAllocation: fix a use-after free crash
2021-04-30 06:33:18 +02:00
swift-ci
bf6c673fd3 Merge pull request #36959 from ktoso/wip-task-locals-revisions 2021-04-29 20:50:01 -07:00
Slava Pestov
826ba58880 GSB: More useful EquivalenceClass::dump() 2021-04-29 23:35:32 -04:00
Slava Pestov
930909f5b2 GSB: Clean up ExplicitRequirement a bit 2021-04-29 23:35:14 -04:00
Slava Pestov
35a2687afe GSB: Pass down requirement signature protocol to computeGenericSignature() 2021-04-29 23:35:14 -04:00
Slava Pestov
4652f06416 GSB: Extract out ExplicitRequirement::getSubjectType() 2021-04-29 23:35:14 -04:00
Kavon Farvardin
c1f48c6855 fix missing effects specifiers on eff props in swiftinterface
I missed the case where the body is also being printed in the
interface file.
2021-04-29 20:29:50 -07:00
Adrian Prantl
5fe0c03d5f Allow functions marked @LLDBDebuggerFunction to bypass actor isolation checks
In order to allow LLDB to evaluate expressions inside an actor without spawining
async functions and potentially continue all threads, this relaxes the actor
isolation checks in @LLDBDebuggerFunction functions to allow a synchronous call
into an extension method.

rdar://75905336
2021-04-29 20:13:30 -07:00