Commit Graph

6605 Commits

Author SHA1 Message Date
swift-ci
a0e79345ee Merge remote-tracking branch 'origin/main' into rebranch 2022-07-05 16:33:13 -07:00
Artem Chikin
3aad9fad9d [SwiftStaticMirror] Create API to query an opaque associated type's protocol requirements 2022-07-05 11:47:58 -07:00
swift-ci
5cb01c1068 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-13 10:33:38 -07:00
Ben Langmuir
090972865c Merge pull request #58992 from mwyman/sourcekitd-repl-fix
Fix assert always triggering in `sourcekitd-repl`
2022-06-13 10:19:37 -07:00
swift-ci
39b1b72efc Merge remote-tracking branch 'origin/main' into rebranch 2022-06-08 15:53:59 -07:00
Rintaro Ishizaki
9f4ce612a2 [SwiftCompilerModules] Link lib_InternalSwiftSyntaxParser to libswift
To use _RegexParser from SwiftSyntax.

* Create 'libswiftCompilerModules_SwiftSyntax.a' which is a subset of
  'libswiftCompilerModules.a'
* Link 'lib_InternalSwiftSyntaxParser' to
  'libswiftCompilerModules_SwiftSyntax.a'
* Factor out swift runtime linking logic in CMake so that dynamic
  libraries can link to Swift runtime, in addition to executables
* Link 'lib_InternalSwiftSyntaxParser' to swift runtime
2022-06-02 12:23:03 -07:00
swift-ci
f02ddd4dac Merge remote-tracking branch 'origin/main' into rebranch 2022-05-31 08:13:54 -07:00
Alastair Houghton
46a746b7c0 Merge pull request #59169 from al45tair/eng/PR-94143566
[Tools] Fix swift-reflection-fuzzer.
2022-05-31 08:09:49 -07:00
swift-ci
870cde61e8 Merge remote-tracking branch 'origin/main' into rebranch 2022-05-31 06:54:14 -07:00
Doug Gregor
11752f8c79 Merge pull request #59163 from DougGregor/more-experimental-features 2022-05-31 06:52:06 -07:00
Alastair Houghton
efe599754c [Tools] Fix swift-reflection-fuzzer.
A couple of things that swift-reflection-fuzzer uses have been updated
without updating swift-reflection-fuzzer, the upshot being that it now
won't build (which also blocks use of swift-demangle-fuzzer).

rdar://94143566
2022-05-31 12:28:42 +01:00
Doug Gregor
22ccb3fc3f Introduce experimental features for autodiff options 2022-05-30 21:26:17 -07:00
swift-ci
06910efd76 Merge remote-tracking branch 'origin/main' into rebranch 2022-05-30 13:14:04 -07:00
Alex Hoppen
01cfba9a64 Merge pull request #59157 from ahoppen/pr/bare-slash-regex-test-helper
[SwiftSyntax] Allow enabling bare slash regex parsing in swift-syntax-parser-test
2022-05-30 22:11:00 +02:00
swift-ci
d32d3311ab Merge remote-tracking branch 'origin/main' into rebranch 2022-05-30 11:14:36 -07:00
Doug Gregor
3cf576da23 Refactor bare slash regex literals as a future feature 2022-05-30 08:33:46 -07:00
Alex Hoppen
0035226cd1 [SwiftSyntax] Allow enabling bare slash regex parsing in swift-syntax-parser-test 2022-05-30 17:19:47 +02:00
swift-ci
9acc1e6fbb Merge remote-tracking branch 'origin/main' into rebranch 2022-05-30 02:14:14 -07:00
Alex Hoppen
7075fb04d6 Merge pull request #59018 from ahoppen/pr/enable-disable-bare-slash
[SwiftSyntax] Add an API to enable or disable bare slash regex literals from SwiftSyntax
2022-05-30 10:57:18 +02:00
swift-ci
b455bd1924 Merge remote-tracking branch 'origin/main' into rebranch 2022-05-27 22:14:10 -07:00
Josh Soref
9e54b97e4f Spelling tools swift inspect (#58559) 2022-05-27 22:07:24 -07:00
swift-ci
4ee528a886 Merge remote-tracking branch 'origin/main' into rebranch 2022-05-27 15:14:25 -07:00
Doug Gregor
b012270fca Adopt experimental-feature infrastructure for move-only feature 2022-05-26 14:21:26 -07:00
Doug Gregor
0de5d7818d Make named opaque types an experimental feature 2022-05-26 13:44:08 -07:00
Doug Gregor
a523473315 Make static assertions an experimental feature 2022-05-26 13:43:36 -07:00
Alex Hoppen
6f7e792637 [SwiftSyntax] Add an API to enable or disable bare slash regex literals from SwiftSyntax
This adds C functions that can be called from SwiftSyntax to enable or disable bare slash regex parsing.

It also adds a function to set the Swift language version - while this is not of top priority at the moment it will become important once we introduce a new language mode again.

rdar://93750821
2022-05-24 09:58:41 +02:00
swift-ci
41506569cc Merge remote-tracking branch 'origin/main' into rebranch 2022-05-23 09:54:30 -07:00
Alex Hoppen
1d750f965c [SwiftSyntax] Parse regex literals using a fallback lexer implemented in C++
`libInternalSwiftSyntaxParser.dylib` currently doesn’t link against `SwiftExperimentalStringProcessing`, so it can’t use the regex lexing functions defined within. This caused SwiftSyntax to fail if the source code contained regex literals.

Implement a fallback regex lexing function in C++ and use it for SwiftSyntax parsing.

rdar://93580240

Co-authored-by: Rintaro Ishizaki <rishizaki@apple.com>
2022-05-20 19:47:11 +02:00
Michael Wyman
55b1444027 Fix assert triggering immediately in sourcekitd-repl.
PR #41550 changed from using `SmallVector::set_size` to `resize_for_overwrite` and `truncate`, but in `sourcekitd-repl` changing from `reserve` changed the size just prior to getting the `end()` of the output array, leading to retrieving the end of the resized array, rather than the array prior to resizing.

The conversion needs to begin at the original output's end, rather than the resized-to-reserve output size, otherwise the conversion triggers the asserts at lines 101 and 116 (with `res == targetExhausted`).
2022-05-19 17:17:09 -07:00
swift-ci
073f16a471 Merge remote-tracking branch 'origin/main' into rebranch 2022-05-19 00:33:46 -07:00
Alex Hoppen
025e919b84 Merge pull request #42258 from ahoppen/pr/no-deadlock-cancellation
[SourceKit] Resolve a nondeterministic deadlock in SourceKit while cancelling
2022-05-19 09:27:27 +02:00
swift-ci
f6cdcc736d Merge remote-tracking branch 'origin/main' into rebranch 2022-05-18 15:18:15 -07:00
Alexis Laferrière
6c287b2b41 Merge pull request #58935 from xymus/swiftmodule-per-sdk-soft-reject
[Serialization] Soft-reject swiftmodules built against a different SDK on tagged compilers
2022-05-18 15:09:48 -07:00
Alexis Laferrière
c8059a09e9 [Serialization] Soft-reject swiftmodules built against a different SDK
Change the way swiftmodules built against a different SDK than their
clients are rejected. This makes them silently ignored when the module
can be rebuilt from their swiftinterface, instead of reporting a hard
error.

rdar://93257769
2022-05-16 13:22:35 -07:00
swift-ci
f05ad9523d Merge remote-tracking branch 'origin/main' into rebranch 2022-05-13 23:54:07 -07:00
Alex Hoppen
727d3fec86 Merge pull request #58852 from ahoppen/pr/ubuntu-22-failure
[SourceKit] Pass the main swift executable path when constructing a compiler invocation
2022-05-14 08:36:35 +02:00
swift-ci
d8e8aaf3c5 Merge remote-tracking branch 'origin/main' into rebranch 2022-05-13 07:33:58 -07:00
Alex Hoppen
1843f22066 Merge pull request #58787 from ahoppen/pr/shorthand-closure-info
[CursorInfo] Report values shadowed using shorthand syntax as secondary results
2022-05-13 16:28:47 +02:00
Alex Hoppen
1525f6b982 [SourceKit] Pass the main swift executable path when constructing a compiler invocation
#58786 (rdar://93030932) was failing because the `swift-frontend` invocations passed a `swiftExecutablePath` to `Invocation.parseArgs`. This caused the `ClangImporter` instance to point to a `clang` binary next to the `swift-frontend` executable while SourceKit used PATH to find `clang`. The clang executable next to `swift-frontend` doesn’t actually exist because `clang` lives in `llvm-linux-aarch64/bin` and `swift-frontend` lives in `swift-linux-aarch64/bin`.
So some checks for a minimum clang verison failed for the normal build (because the executable doesn’t actually exists) while they pass during the SourceKit build (which used `clang` from `PATH`). This in turn caused the `outline-atomics` to be enabled to the SourceKit clang compiler arguments but not the clang compiler arguments for a normal build and thus resulted in two separate module cache directories (which includes the enabled features in the module directory hash).

To fix this issue, also set the swift executable path for compiler invocations created from SourceKit.

Fixes #58786 (rdar://93030932)
2022-05-13 09:05:38 +02:00
Ben Barham
8148c763cd Merge pull request #58847 from bnbarham/rebranch-test-fixes
[next] Fixes for various test failures on rebranch
2022-05-12 09:30:39 -07:00
Alex Hoppen
0c336882d6 Merge pull request #58681 from ahoppen/pr/guard-dependency-stamps
[SourceKit] Guard DependencyStamps with a lock
2022-05-12 08:11:48 +02:00
Ben Barham
427a689a96 [next] Convert const char * fields to StringRef
llvm/llvm-project d0262c2394f46bb7da2a75529413d625c70908e5 added a new
default bool param to the two constructors in `SmallVectorMemoryBuffer`.
Since `options.OutputPath` is a `const char *` and that can be promoted
to a `bool`, the constructor being called was changed to the first
constructor (with a default buffer name) - promotion is preferred over
conversion.

Convert the various output paths to a `StringRef` - all their uses
converted to `StringRef` anyway. Also specify the default parameter in
order to maintain the old behaviour, which didn't require a null
terminator.
2022-05-11 17:06:29 -07:00
Ben Barham
a6a6ae456a [next] Use SmallString over reserved std::string
A `llvm::raw_string_ostream` is unbuffered, but calling `SetBufferSize`
adds a buffer. Since its destructor doesn't flush (as it assumes it is
unbuffered), this then asserts in the `llvm::raw_ostream` destructor.
Remove the `SetBufferSize` call (the string is the underlying buffer)
and also switch to using `llvm::SmallString` instead.

This fixes a crash in `SourceKit/SyntaxTree/basic.swift` and
`SourceKit/SyntaxTree/pound_if.swift`, which are presumably the only two
tests that actually use this.
2022-05-11 17:06:29 -07:00
Alex Hoppen
2b364930fc [CursorInfo] Report values shadowed using shorthand syntax as secondary results
When a variable is re-declared using shorthand syntax (`[foo]` closure capture or `if let foo {`), the user doesn’t perceive this as a new variable declaration. Thus, we should return the original declaration as a secondary result.

rdar://91311033
rdar://75455650
2022-05-11 08:05:26 +02:00
Alex Hoppen
bbd2848723 Merge pull request #58684 from ahoppen/pr/related-idents
[SourceKit] In related identes, report underlying var of closure capture and shorthand if let binding
2022-05-09 16:56:15 +02:00
Alex Hoppen
d0d3d42967 [SourceKit] In related identes, report underlying var of shorthand if let binding 2022-05-06 10:10:10 +02:00
Alex Hoppen
64e27a270e [SoruceKit] Add the underlying variable to related identifiers for a captured variable
Previously, the related idents request wouldn’t look through caputred variables like `[foo]`. Change the logic to consider the captured variable as well as the variable that’s implicitly declared for use inside the closure.

rdar://81628899
2022-05-06 10:10:10 +02:00
Alex Hoppen
351770c2c3 [SourceKit] Guard DependencyStamps with a lock
We might run into situations where `matchesSourceState` reads `DependencyStamps` while they are being written in `buildASTUnit`, causing a crash.

Guard `DependencyStamps` by a mutex to avoid this problem. We don’t need to provide any ordering guarantees about whether `DependencyStamps` have been computed in are accessed because we already assume that the dependencies shouldn't change (much) in the time between an `ASTBuildOperation` is created and until it produced an AST.

rdar://92748564
2022-05-05 10:49:32 +02:00
swift-ci
deb5b50f5c Merge pull request #58572 from jsoref/spelling-tools-swift-serialize-diagnostics
Spelling tools swift serialize diagnostics
2022-05-04 11:26:46 -07:00
swift-ci
29962c92c1 Merge pull request #58571 from jsoref/spelling-tools-swift-syntax-test
Spelling tools swift syntax test
2022-05-04 11:23:24 -07:00