Commit Graph

1528 Commits

Author SHA1 Message Date
Robert Widmann
3764ef8a9a Drop libSyntax's Unit Tests
We no longer intend to support the libSyntax AST, so let's drop
the tests that are only going to get in the way of us iterating
on the Swift Syntax tree.
2022-09-14 23:16:08 -07:00
Robert Widmann
86ee409675 Update Unit Tests for Function Parameter Syntax Change
This broke in https://github.com/apple/swift-syntax/pull/793 when
I updated the function parameter declaration representation to
include isolated and const.
2022-09-14 18:33:11 -07:00
Robert Widmann
18b79ffcfd Resolve a Layering Violation in libBasic
Basic should not be allowed to link Parse, yet it was doing so
to allow Version to provide a constructor that would conveniently
parse a StringRef. This entrypoint also emitted diagnostics, so it
pulled in libAST.

Sink the version parser entrypoint down into Parse where it belongs
and point all the clients to the right place.
2022-09-09 00:21:30 -07:00
Slava Pestov
046c2040ce Merge pull request #60726 from slavapestov/variadic-generics-bits
AST: Plumbing for pack conformances and a few other variadic generics bits
2022-08-24 08:59:40 -04:00
Artem Chikin
7d94c24123 Merge pull request #60712 from artemcm/RemoveRedundantScanCommandCombo
[Dependency Scan] Remove redundant recombination of arguments in 'initCompilerInstanceForScan' into a string, before being re-parsed.
2022-08-23 12:57:11 -07:00
Slava Pestov
7a16b0275b AST: Allow one-element tuple types to be constructed
These will never appear in the source language, but can arise
after substitution when the original type is a tuple type with
a pack expansion type.

Two examples:
- original type: (Int, T...), substitution T := {}
- original type: (T...), substitution T := {Int}

We need to model these correctly to maintain invariants.

Callers that previously used to rely on TupleType::get()
returning a ParenType now explicitly check for the one-element
case instead.
2022-08-23 11:12:00 -04:00
Artem Chikin
baec3154a0 [Dependency Scan] Remove redundant recombination of arguments in 'initCompilerInstanceForScan' into a string, before being re-parsed.
This does not seem to serve a purpose other than corrupting arguments with whitespaces - they get merged into one large string where the whitespace boundary between arguments and whitespaces within arguments are blurred.

Part of rdar://98985453
2022-08-22 16:12:58 -07:00
Pavel Yaskevich
5a164c5f8a [Frontend] Switch from YAML to .strings based localization 2022-08-22 10:23:06 -07:00
Alex Hoppen
e22e443596 [SourceKit] Re-enable cancellation of non-completion requests
This enables the ability to cancel requests, which aren’t code completion requests, again.

Previous crashes in SILGen are prevented by disabling cancellation during the SIL stages. Instead, we add dedicated cancellation checkpoints before and after SIL.

rdar://98390926
2022-08-16 16:02:23 +02:00
Rintaro Ishizaki
85ea21cf2b Merge pull request #60563 from rintaro/no-garbage-in-swift
Terminology change: 'garbage' -> 'unexpected'
2022-08-15 17:18:42 -07:00
Rintaro Ishizaki
a673043737 Terminology change: 'garbage' -> 'unexpected'
There are no "garbage" characters in Swift code. They are just
"unexpected."
2022-08-15 14:32:28 -07:00
swift-ci
a760571edb Merge remote-tracking branch 'origin/main' into rebranch 2022-08-04 09:13:27 -07:00
Alex Hoppen
c2695f0ffc [libSyntax] Allow adding garbage nodes in between any two children of a syntax node
When the source code is invalid, this allows us to represent tokens that could not be used to form a valid syntax tree with more fidelity.

This commit does not start using GarbageNodes yet, it just sets everything up for them.
2022-08-04 09:20:31 +02:00
swift-ci
efdf3b5ff9 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-20 16:15:13 -07:00
Doug Gregor
3e53290187 Merge pull request #60052 from DougGregor/syntax-decl-cleanup
[Syntax] Clean up syntax grammar for declaration nodes
2022-07-20 16:09:28 -07:00
swift-ci
8771684a28 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-14 02:13:20 -07:00
Doug Gregor
73debb48f3 [Syntax] Factor out the detail for a declaration modifier. 2022-07-13 21:49:23 -07:00
Erik Eckstein
6760dc420c SIL: add a utility which can manage per-value and per-instruction bitfields and flags efficiently.
It's used to implement `InstructionSet` and `ValueSet`: sets of SILValues and SILInstructions.
Just like `BasicBlockSet` for basic blocks, the set is implemented by setting bits directly in SILNode.
This is super efficient because insertion and deletion to/from the set are basic bit operations.

The cost is an additional word in SILNode. But this is basically negligible: it just adds ~0.7% of memory used for SILInstructions.
In my experiments, I didn't see any relevant changes in memory consumption or compile time.
2022-07-13 14:27:50 +02:00
swift-ci
80161c6d49 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-11 11:53:51 -07:00
Robert Widmann
003b362a65 Differentiate Shebang from Garbage
Add #! as an explicit kind of trivia.
2022-07-08 18:28:57 -07:00
swift-ci
83a6161e32 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-08 14:13:45 -07:00
Robert Widmann
e2bb54fcb5 Remove Modeling for Fully-Generic Primary Associated Type Syntax
Constraints in these positions were not accepted. Remove the modeling
for them.
2022-07-08 10:51:25 -07:00
swift-ci
eec184df23 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-07 02:14:43 -07:00
Yuta Saito
356156dfb9 [Threading][unittest] skip try_lock checks under none threading 2022-07-07 01:57:38 +00:00
Alastair Houghton
14e01b015a [Threading][UnitTests] Don't use threads in the unit test in no-threads mode.
If the threading package is set to "none", don't actually use threads in the
unit tests.

rdar://95011060
2022-07-07 01:57:38 +00:00
swift-ci
a9ee4f4a90 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-05 13:14:44 -07:00
Doug Gregor
3c892a153c Update runtime compatibility hooks to version 5.8 2022-07-05 10:07:52 -07:00
swift-ci
e720aaef9d Merge remote-tracking branch 'origin/main' into rebranch 2022-06-30 20:53:40 -07:00
Robert Widmann
19b27c5eb7 Merge pull request #59763 from CodaFi/mangolia 2022-06-30 20:46:38 -07:00
swift-ci
3e99d630a5 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-30 15:53:44 -07:00
Robert Widmann
dde0d8f609 Generalize the Mangling of Constrained Existential Types
Upgrade the old mangling from a list of argument types to a
list of requiremnets. For now, only same-type requirements
may actually be mangled since those are all that are available
to the surface language.

Reconstruction of existential types now consists of demangling (a list of)
base protocol(s), decoding the constraints, and converting the same-type
constraints back into a list of arguments.

rdar://96088707
2022-06-30 15:32:37 -07:00
Augusto Noronha
6a82edd366 Fix nested generic typerefs applying generic params at the wrong level
Generic params of typerefs are supposed to be "attached" on the level
they belong, not as a flat list, unlike other parts of the system. Fix
the application of bound generic params by checking how many were
already applied in the hierarchy and ignoring those already attached.
2022-06-22 16:33:38 -07:00
swift-ci
750a3dc7e6 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-15 08:14:55 -07:00
Mike Ash
30cb7a20c3 Merge pull request #59349 from mikeash/concurrency-tracing-log-categories
[Concurrency] Set final subsystem/categories for concurrency tracing.
2022-06-15 11:14:25 -04:00
Mike Ash
72499c5753 [Concurrency] Set final subsystem/categories for concurrency tracing. 2022-06-13 11:36:09 -04:00
Ben Barham
0d96000b94 [next] Add missing chrono include
`std::chrono::high_resolution_clock` is being used in
`FrozenMultiMapTest.cpp` but it was relying on `chrono` being included
transitively. Include it directly.
2022-06-09 12:50:01 -07:00
Alastair Houghton
6962758c8c [Threading] Add the ability to use any C++ callable in swift::once().
This allows the use of C++ lambdas and functors, in addition to plain
old functions.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alastair Houghton
0e9318cec5 [Threading] Put everything through git clang-format.
Just formatting changes.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alastair Houghton
210b772800 [UnitTests][Windows] Link with Synchronization.lib
The runtime unit tests also need to link with Synchronization.lib.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alastair Houghton
3bfc7e0731 [Threading][Windows] Link the unit test against Synchronization.lib
We need to link the threading unit test against Synchronization.lib
to pick up the Win32 APIs we're using.

rdar://90776105
2022-06-07 07:39:52 +01:00
Alastair Houghton
6d1b6dbd1c [Threading] Fix the Linux build.
A few fixes specifically for the Linux build.

rdar://90776105
2022-06-07 07:39:52 +01:00
Alastair Houghton
785f4a215c [Unittests] Add more threading library tests.
Added explicit tests for `swift::once` and also for the ulock implementation
used on Linux.

rdar://90776105
2022-06-07 07:39:51 +01:00
Alastair Houghton
2ba80e1180 [Unittests] Make the Threading unit tests work.
The threading unit tests currently just check the operation of Mutex.
This used to be part of the runtime tests, but now it's a separate
library we can test it separately.

rdar://90776105
2022-06-07 07:39:51 +01:00
Alastair Houghton
f5bdb858e0 [Threading] Create new threading library and use it.
Moved all the threading code to one place.  Added explicit support for
Darwin, Linux, Pthreads, C11 threads and Win32 threads, including new
implementations of Once for Linux, Pthreads, C11 and Win32.

rdar://90776105
2022-06-07 07:39:51 +01:00
Alastair Houghton
66b9d21000 [Runtime] Remove all use of read/write locks.
Read/write locks are not as good as you'd think; a simple mutex is better in
almost all cases.

rdar://90776105
2022-06-07 07:39:51 +01:00
Alastair Houghton
0cf687aa2b [Build][Runtime] Replace SWIFT_STDLIB_SINGLE_THREADED_RUNTIME.
SWIFT_STDLIB_SINGLE_THREADED_RUNTIME is too much of a blunt instrument here.
It covers both the Concurrency runtime and the rest of the runtime, but we'd
like to be able to have e.g. a single-threaded Concurrency runtime while
the rest of the runtime is still thread safe (for instance).

So: rename it to SWIFT_STDLIB_SINGLE_THREADED_CONCURRENCY and make it just
control the Concurrency runtime, then add a SWIFT_STDLIB_THREADING_PACKAGE
setting at the CMake/build-script level, which defines
SWIFT_STDLIB_THREADING_xxx where xxx depends on the chosen threading package.

This is especially useful on systems where there may be a choice of threading
package that you could use.

rdar://90776105
2022-06-07 07:39:51 +01:00
Alex Hoppen
4aa2bbbf06 Revert "Merge pull request #42447 from al45tair/eng/PR-90776105"
This reverts commit 8bcb71140f, reversing
changes made to c4dd271d36.
2022-06-02 18:03:23 +02:00
Alastair Houghton
8bcb71140f Merge pull request #42447 from al45tair/eng/PR-90776105
[Build][Runtime] Add a new threading library.
2022-06-01 12:57:23 -07:00
swift-ci
645d73f27e Merge pull request #58480 from beccadax/so-i-put-versions-in-your-version-numbers
Update SWIFT_COMPILER_VERSION language features
2022-05-24 17:47:43 -07:00
Alastair Houghton
901ceaef13 [Threading] Add the ability to use any C++ callable in swift::once().
This allows the use of C++ lambdas and functors, in addition to plain
old functions.

rdar://90776105
2022-05-24 14:57:42 +01:00