Commit Graph

6605 Commits

Author SHA1 Message Date
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
5ae1834e59 Merge pull request #72370 from ahoppen/ahoppen/decl-cursor-info-from-solution
[SourceKit] Allow generation of cursor info for declarations from solutions that haven’t aren’t applied to the AST
2024-03-22 08:24:58 +01:00
Rintaro Ishizaki
c9785d955d [SourceKit] Stop printing normal comments in clang generated interface
Generated interfaces for Clang modules used to try printing normal
comments between decls extracted from the header text. That was because
doc-comment was not common in C/ObjC headers. But mainly because of
"import as member feature" Clang decls aren't printed in the order as
they appear in the header file, the logic determinig which comment
belongs to which decl was not working property. We've decided to remove
that feature and only print the proper doc-comments as it has been
getting common.

rdar://93731287
2024-03-21 11:52:32 +09:00
Artem Chikin
716a1a9dfc Merge pull request #72104 from artemcm/InitSwiftModulesInDepScan
[Dependency Scanning] Initialize Swift modules in libSwiftScan on scanner creation
2024-03-20 09:22:14 -07: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
Artem Chikin
e755e7239e [Dependency Scanning] Initialize Swift modules in libSwiftScan on scanner creation
Resolves rdar://124100615
2024-03-19 13:01:38 -07:00
Kavon Farvardin
76c6510519 Merge pull request #72276 from kavon/ncgenerics-xfails-3 2024-03-16 04:18:35 -07: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
Kavon Farvardin
149c052ec5 use new noncopyable types infrastructure
The infrastructure underpinning the new feature NoncopyableGenerics is
mature enough to be used.
2024-03-14 23:10:44 -07: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
f3e288a30a Merge pull request #72128 from hamishknight/fix-leak
[SourceKit] Fix an `xpc_object` leak
2024-03-07 10:22:44 +00:00
Artem Chikin
d113ea11ac Merge pull request #72067 from artemcm/FixTransitiveHeaderLookupInDependencyScan
[Dependency Scanning] Scan header inputs of binary Swift module dependencies
2024-03-06 16:05:12 -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
Artem Chikin
bfa8c0ee4f [Dependency Scanning] Scan header inputs of binary Swift moduel dependencies
Otherwise they may have module dependencies of their own which will not be detected by the scanner and included in the list of explicit inputs for compilation.
2024-03-06 11:02:35 -08: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
Artem Chikin
d2a8e32bc5 [Dependency Scanning] Collect emitted diagnostics per-scan-query 2024-02-27 14:51:54 -08:00
Egor Zhdan
d3a0bf4ea8 Merge pull request #71836 from apple/egorzhdan/cxx-tests-swift-6
[cxx-interop] Run tests with `swift-6` compat mode
2024-02-26 10:52:03 +00: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
Egor Zhdan
78b9de1391 [cxx-interop] Run tests with swift-6 compat mode 2024-02-23 16:24:14 +00: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
Artem Chikin
6831c2430f Merge pull request #71792 from artemcm/DepScanDiagConsumerIsolate
[Dependency Scanning] Guard access to shared state of the `DependencyScannerDiagnosticCollectingConsumer`
2024-02-22 10:44:55 -08:00
Artem Chikin
5c4bbc16f6 [Dependency Scanning] Guard access to shared state of the DependencyScannerDiagnosticCollectingConsumer
Resolves rdar://123344065
2024-02-21 14:59:00 -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
Slava Pestov
4f61ec33d3 Merge pull request #71764 from slavapestov/ncgenerics-xfail
Fix some NoncopyableGenerics test failures and mark remaining as XFAIL
2024-02-21 05:36:01 -05:00
Slava Pestov
0eb146f50a lldb-moduleimport-test: pass correct enableNoncopyableGenerics value to validateSerializedAST() 2024-02-20 18:26:05 -05: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
Adrian Prantl
af84f5a4d3 Merge pull request #71634 from adrian-prantl/118846313
Fix caching bug in MemoryBufferSerializedModuleLoader
2024-02-15 19:38:07 -08:00
Adrian Prantl
543a2cd685 Fix caching bug in MemoryBufferSerializedModuleLoader
By populating the memory cache before loading the module, we can avoid a cycle
where a module is imported that is an overlay, which then triggers
ClangImporter, which then (redundantly) triggers the import of the overlay
module, which would reimport the module again, since it's import is still
underway and it hasn't been entered into the cache yet.

rdar://118846313
2024-02-15 14:06:28 -08:00
Doug Gregor
81ffafdc6a Merge pull request #70602 from ApolloZhu/macro/expression-as-default-argument
[Macros] Expression macro as caller-side default argument
2024-02-14 16:10:11 -08:00
Steven Wu
9607e9dec1 Merge pull request #71497 from cachemeifyoucan/eng/PR-122423965
[Caching] Use subInvocation to verify interface
2024-02-13 09:18:40 -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
Steven Wu
3986937e03 [Caching][NFC] Restructure CASOption in swift. NFC
Clean up how CASOptions are kept and passed inside swift to make the
code more readable. Also avoid a copy of CAS configuration in
ClangImporter.
2024-02-11 14:08:09 -08:00
Kavon Farvardin
9a6027d21a IDE: sort the output of LookedupTypeNames
Any changes to the order in which lookups happen would require
changing all the regression tests.
2024-02-11 12:54:35 -08:00
Kavon Farvardin
6ca57e332c Merge pull request #71488 from kavon/ncgenerics-test-fixes-kavon-v5
Ncgenerics test fixes kavon v5
2024-02-08 22:32:54 -08:00
Steven Wu
0e122f1aba [libSwiftScan] Fix a use-after-free in replay instance creation
The response file expansion function doesn't return all the arguments
allocated using StringSaver produced. It only use the StringSaver to
save the newly expanded arguments. Need to make sure all the original
arguments are saved so they can be used later during replay.

rdar://121808135
2024-02-07 16:00:23 -08:00
Kavon Farvardin
a396fcc43a LangOptions: tie NoncopyableGenerics to build
There were a handful of different places trying to enable the
feature-flag when the stdlib has been built with the feature enabled.
This change cleans that up and unifies it in one spot for all sub-tools
like sil-opt and sil-func-extractor to pick-up.
2024-02-07 15:48:31 -08:00
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
Konrad `ktoso` Malawski
5acd366c98 [macros] allow forwarding generic arguments through macro declarations (#71271)
* [macros] allow forwarding generic arguments through macro declarations

[macros] add more tests for generic argument forwarding in macro declarations

* [macros] correct replacement picking logic
2024-02-06 03:56:20 -08:00
Hamish Knight
16cfca4186 [ASTWalker] NFC: Rename SkipChildren -> SkipNode
This better describes what the action currently
does, and allows us to re-introduce `SkipChildren`
with the correct behavior.
2024-02-05 15:27:25 +00:00
Rintaro Ishizaki
b12370a7ca Merge pull request #71342 from rintaro/ast-attrkind 2024-02-02 13:16:14 -08:00
Guillaume Lessard
114f235d17 Merge pull request #71167 from vanvoorden/vanvoorden/inclusive-language
[Inclusive Language][Comments][Documentation] migrate "sanity" checks to "soundness" checks
2024-02-02 10:27:34 -08:00
Rintaro Ishizaki
92e70ef80a [AST] Remove DeclAttrKind::Count
Introduce NumDeclAttrKinds for number of enum values. Use optional for
invalid attribute kind. This align with `TypeAttrKind`.
2024-02-02 09:36:49 -08:00