Commit Graph

2325 Commits

Author SHA1 Message Date
Holly Borla
5da7ac6cbd [NFC] Use DeclAttributes::isDeprecated in a few more places. 2024-06-10 07:16:44 -07:00
swift-ci
ac43224e86 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-20 13:24:24 -07:00
Rintaro Ishizaki
39d633f5a8 [CodeCompletion] Remove unused 'isAsync' flag from CodeCompletionResult 2024-05-15 13:43:19 -07:00
swift-ci
caf307833c Merge remote-tracking branch 'origin/main' into rebranch 2024-05-04 01:34:28 -07:00
Alastair Houghton
6afdcd311f Merge pull request #72061 from al45tair/eng/PR-123504095
[Linux][Runtime][IRGen] Mark metadata sections as retained and support section GC.
2024-05-04 09:23:06 +01:00
swift-ci
f28f34bb81 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-03 10:15:11 -07:00
Rintaro Ishizaki
6264792d19 [SourceKit] Don't use SourceEntitityWalker for placeholder expansion
Placeholder expansion should be a syntactic operation, but
`SourceEntityWalker` can invoke type checking operations, which causes
unexpected bahaviors including crashes.

rdar://121360941`
2024-05-02 11:52:13 -07:00
swift-ci
7b5298cd01 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-02 03:15:34 -07:00
Hamish Knight
9f7262e3d7 Merge pull request #73361 from hamishknight/uncache
[SourceKit] Remove cached AST by default on close
2024-05-02 11:14:53 +01:00
swift-ci
c8d364261c Merge remote-tracking branch 'origin/main' into rebranch 2024-05-01 16:55:47 -07:00
Slava Pestov
fda93680df Merge pull request #73363 from slavapestov/pack-expansion-closures-part-2
Extract common code for building opened existential and element signatures
2024-05-01 19:44:05 -04:00
Slava Pestov
3b2a6d8c1a SourceKit: Use getNextDepth()/getMaxDepth() 2024-05-01 12:09:01 -04:00
Hamish Knight
e710b50255 [SourceKit] Remove cached AST by default on close
This isn't actually used for anything currently,
future requests will always have mismatching
stamps. As such, remove for now.

rdar://127353509
2024-05-01 12:24:13 +01:00
swift-ci
22d81cbbd2 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-01 04:14:10 -07:00
Hamish Knight
de9806e2fa [SourceKit] Introduce key for cancelling on close
Defaults to `true`.
2024-04-30 21:13:20 +01:00
Hamish Knight
69f2e26d35 [SourceKit] Cancel in-flight builds on editor.close
When closing a document, cancel any in-flight
builds happening for it.

rdar://127126348
2024-04-30 12:00:27 +01:00
Hamish Knight
572fc4eae0 [SourceKit] Ensure ASTCache is guarded by mutex
There were a couple of accesses not guarded by
`CacheMtx`, introduce a couple of methods that
guard them, renaming `getASTProducer` while here.

Also make sure we don't ever insert a producer
after it has been purposefully removed by e.g a
close that removes the cached AST.
2024-04-30 12:00:27 +01:00
swift-ci
c283c8f833 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-30 00:15:17 -07:00
eeckstein
74ed041119 Merge pull request #73247 from eeckstein/windows-enable-swift
Enable SwiftCompilerSources on Windows
2024-04-30 09:04:55 +02:00
swift-ci
8743aa2219 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-29 07:54:44 -07:00
Alastair Houghton
7698836ecc [Test][SourceKit] Use the *builder*'s swiftrt.o when in hosttools.
We were linking with the newly built `swiftrt.o` when in hosttools mode,
which is wrong because the newly built `swiftrt.o` does not match the
compiler we were using for the `SwiftCompilerSources`.

This manifests as a failure in

  `SwiftCompilerSources/Sources/Optimizer/Utilities/Verifier.swift`

because `self is ForwardingInstruction` fails as we can't find the
protocol conformance records.

rdar://123504095
2024-04-29 10:48:23 +01:00
eeckstein
e9d6ba9154 cmake: enable SwiftCompilerSources on Windows 2024-04-29 10:52:24 +02:00
Eric Miotto
291065d3b1 CMake: amend search path for Swift content from Darwin toolchain
Additional testing showed that the path I initially choose does not work
in all scenarios.

Expands on #73255
Still addresses rdar://127014753
2024-04-26 15:12:24 -07:00
swift-ci
9437f51fce Merge remote-tracking branch 'origin/main' into rebranch 2024-04-26 07:54:41 -07:00
Eric Miotto
5f545b43f9 CMake: add option to link Swift content from Darwin toolchain
This is needed in specific Apple internal configurations -- as a result
of the limited applicability, this option is not exposed through
`build-script` on purpose.

Addresses rdar://127014753
2024-04-25 12:48:50 -07:00
Nate Chandler
c43f87101f Merge branch 'main' into rebranch
Conflicts:
      lib/Basic/Platform.cpp

```
diff --git a/lib/Basic/Platform.cpp b/lib/Basic/Platform.cpp
index 240edfa144a..1797c87635f 100644
--- a/lib/Basic/Platform.cpp
+++ b/lib/Basic/Platform.cpp
@@ -200,10 +200,7 @@ StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
   case llvm::Triple::CUDA:
   case llvm::Triple::DragonFly:
   case llvm::Triple::DriverKit:
-<<<<<<< HEAD
   case llvm::Triple::ELFIAMCU:
-=======
->>>>>>> main
   case llvm::Triple::Emscripten:
   case llvm::Triple::Fuchsia:
   case llvm::Triple::HermitCore:
```
2024-04-17 13:32:48 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Ben Barham
a9077d7129 FileEntry to FileEntryRef updates 2024-04-08 08:58:58 -07:00
Ben Barham
acd0efa67f Migrate to common OptTable macros
`OptTable` was a source of consistent churn due to new arguments to the
`OPTION` macro. LLVM 3f092f37b7362447cbb13f5502dae4bdd5762afd extracted
the handling of the common option parts (eg. an ID and an info) out into
separate macros to reduce this - use those here (since unsurprisingly,
more arguments were added).
2024-04-08 08:58:58 -07:00
Ben Barham
1fdda023b3 Rename StringRef::endswith references to StringRef::ends_with
Missed this when doing the `startswith` renaming. `endswith` has also
been deprecated upstream (and presumably soon to be removed).
2024-04-01 10:59:16 -07:00
Konrad `ktoso` Malawski
6132386371 [Distributed] Complete handling of protocol calls and witnesses using adjusted mangling scheme (#72416) 2024-03-23 23:54:23 +09:00
Alex Hoppen
ef3e1c1d4f [SourceKit] Allow generation of cursor info for declarations from solutions that haven’t aren’t applied to the AST ye
This has two benefits:
1. We can now report ambiguous variable types
2. We are more robust in the generation of results for declarations inside closures. If the closure has an error, we won’t apply the solution to the AST and thus any cursor info that tried to get types out of the AST would fail.

rdar://123845208
2024-03-20 14:52:39 +01:00
eeckstein
9504de5ed7 Merge pull request #71552 from finagolfin/cross-compile
[CMake] Add broader support for cross-compiling the portions of the compiler that are written in Swift to non-Darwin Unix
2024-03-15 16:28:38 +01:00
Rintaro Ishizaki
91dc6822fa Merge pull request #72310 from rintaro/ifconfigregisons-per-clause
[SourceKit] Use recorded #if regions in 'active-regions' request
2024-03-15 06:22:51 +09:00
Ben Barham
9779c18da3 Rename startswith to starts_with
LLVM is presumably moving towards `std::string_view` -
`StringRef::startswith` is deprecated on tip. `SmallString::startswith`
was just renamed there (maybe with some small deprecation inbetween, but
if so, we've missed it).

The `SmallString::startswith` references were moved to
`.str().starts_with()`, rather than adding the `starts_with` on
`stable/20230725` as we only had a few of them. Open to switching that
over if anyone feels strongly though.
2024-03-13 22:25:47 -07:00
Rintaro Ishizaki
2abddcb260 [SourceKit] Use recored #if regions in "active regions" request
* Record each IfConfig clause location info in SourceFile
* Update SILProfiler to handle them
* Update SwiftLangSupport::findActiveRegionsInFile() to use the recorded
  regions instead of walking into AST to find #if regions

rdar://118082146
2024-03-14 08:52:57 +09:00
Alex Hoppen
ed58b9ac4e Merge pull request #72170 from ahoppen/ahoppen/enable-barrier-race
[SourceKit] Set `RequestBarriersEnabled` as early as possible
2024-03-07 19:56:32 -08:00
Alex Hoppen
44bbe6a4f9 [SourceKit] Set RequestBarriersEnabled as early as possible
We were only setting `RequestBarriersEnabled` after dispatching the request to `requestQueue`. This left a brief gap where new requests could come in that wouldn’t see `RequestBarriersEnabled = true`.
2024-03-07 15:57:21 -08:00
Hamish Knight
09052c5977 [SourceKit] Fix an xpc_object leak
Make sure we release the `event` for cancellation
requests. This also ensures the `xpc_transaction`
for the request is ended.
2024-03-06 22:07:31 +00:00
Slava Pestov
a535948e3b AST/SourceKit: Fix printing of inheritance clauses (sort of)
This still needs a lot more cleanup.
2024-03-01 12:19:15 -05:00
Ben Barham
1306f2b32a Merge pull request #71863 from bnbarham/remove-makearrayref
Use the new template deduction guides rather than `makeArrayRef`
2024-02-25 21:06:51 -08:00
Alex Hoppen
32c305fb9c Merge pull request #71831 from ahoppen/ahoppen/raw-doc-comment
[SourceKit] Add the raw doc comment to the cursor info response
2024-02-24 17:55:53 -08:00
Alex Hoppen
873ed19786 [SourceKit] Add the raw doc comment to the cursor info response
SourceKit-LSP currently parses the XML comment to generate Markdown again but round-tripping a (probably markdown) doc comment to XML to Markdown is lossy in many cases and unnecessary work. Include the comment as it is spelled in source in the cursor info response so that sourcekit-lsp can display it.

Part of rdar://120685874
2024-02-24 08:41:08 -08:00
Ben Barham
f292ec9784 Use the new template deduction guides rather than makeArrayRef
LLVM has removed `make*ArrayRef`, migrate all references to their
constructor equivalent.
2024-02-23 20:04:51 -08:00
Alex Hoppen
104ee1336a Merge pull request #71824 from ahoppen/ahoppen/abort
[SourceKit] Exit the `SourceKitService` process on a SIGTERM
2024-02-23 17:04:52 -08:00
Alex Hoppen
6d23bf63a7 [SourceKit] Abort the SourceKitService proces on a SIGTERM
Sending a `SIGTERM` to sourcekitd XPC service lead to very surprising results: XPC thought that the process was about to die and sends a Connection Interrupted notification to the client. But other than that, we didn’t actually handle the signal and the service stayed alive. This caused us to send a `sema_disabled` notification to the client but since the service never got relaunched, we never sent the corresponding `sema_enabled` notification.

To fix this, just properly die on `SIGTERM` by calling `abort`.
2024-02-22 16:58:47 -08:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Ben Barham
0755fd3259 Merge pull request #69076 from barinsim/local-symbols
[SourceKit] Add option to index local symbols to IndexSource request
2024-02-20 14:54:07 -08:00
Finagolfin
fcf7614638 [CMake] Add broader support for cross-compiling the portions of the compiler that are written in Swift to non-Darwin Unix
Add cross-compilation flags for the newly added Swift source in `lib/ASTGen/`,
similar to how `SwiftCompilerSources/` is already cross-compiled for other
platforms. Make sure the Swift source in the compiler builds and links against
`SWIFTLIB_DIR` in this cross-compilation build directory, not the one that comes
with the native host compiler.

This requires changing the dependency chain in `CROSSCOMPILE` mode, as normally
the Swift compiler is built first when building natively for the host, then it's
used to build the stdlib. However, when cross-compiling the toolchain, the stdlib
must be cross-compiled first by the host compiler, then the portions of the
Swift compiler written in Swift must be cross-compiled with that new stdlib. All
these dependency changes simply change that compilation order when cross-compiling,
including removing the dependency that the Swift compiler is built before the
stdlib when cross-compiling the Swift compiler.

All changes in this pull are gated on the `CROSSCOMPILE` mode, so they will
not affect any of the existing CI or build presets.
2024-02-13 12:24:24 +05:30
Apollo Zhu
f003c49fdf [WIP] Disallow macro default argument with argument
Need to use variable from caller side context
2024-02-06 15:02:12 -08:00