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
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
Rintaro Ishizaki
8fdc4cc225
[AST] Split Attr.def to DeclAttr.def and TypeAttr.def
2024-02-02 09:36:49 -08:00
Rintaro Ishizaki
b839718351
[AST] Use scoped enum for attribute kinds
...
Align with other kind enum e.g. DeclKind.
2024-02-02 09:36:48 -08:00
Hamish Knight
27c08b130a
Merge pull request #71123 from hamishknight/sema-expr-return
...
Move the single-expr return transform from Parse to Sema
2024-01-31 10:13:24 +00:00
Hamish Knight
9b64990d24
[AST] Remove the "single expression body" bit
...
Remove this bit from function decls and closures.
Instead, for closures, infer it from the presence
of a single return or single expression AST node
in the body, which ought to be equivalent, and
automatically takes result builders into
consideration. We can also completely drop this
query from AbstractFunctionDecl, replacing it
instead with a bit on ReturnStmt.
2024-01-30 14:08:54 +00:00
Hamish Knight
f4a6b95d24
Move single-expr return transform from Parse to Sema
...
Rather than doing the transform in the parser, and
then potentially undoing it in Sema, move the
entire transform into Sema. This also lets us
unify the logic between function decls and
closures, and allows ASTGen to benefit from it.
2024-01-30 14:08:53 +00:00
Alex Hoppen
f0ea24dd29
[SourceKit] Fix a crash when performing related identifers request on self
...
Performing a related identifiers request on `self` returns an empty result because `self` is not an identifier. We thus can’t retrieve the first location to compute the old name.
rdar://121668042
2024-01-29 15:51:27 -08:00
Alex Hoppen
5e803c6b6c
Merge pull request #71081 from ahoppen/ahoppen/remove-call-pattern-heuristics
...
[CodeComplete] Remove code for call pattern heuristics and `ConjunctionElement::mightContainCodeCompletionToken`
2024-01-23 07:38:30 -08:00
Alex Hoppen
2ab9f63810
Merge pull request #71049 from ahoppen/ahoppen/dont-realpath-solver-based-cursor-info
...
[SourceKit] Don't realpath the primary file path
2024-01-23 07:33:18 -08:00
Alex Hoppen
c8424c1b7a
[CodeComplete] Remove code for call pattern heuristics
...
These options weren’t used anymore, so we can remove them.
2024-01-22 19:57:12 -08:00
Alex Hoppen
8625b3f119
[SourceKit] Don't realpath the primary file path
...
If the file didn’t exist on disk, `fileSystem->getRealPath` returns an empty string, which means we can’t find the `InputBuffer` and thsu won’t run solver-based cursor info. There’s no reason to realpath `PrimaryInputPath`, `getMemoryBuffer` already does that.
rdar://120737244
2024-01-22 14:36:24 -08:00
Hamish Knight
3f4b45b012
[AST] Remove SerializedLocalDeclContext
...
It's not clear that its worth keeping this as a
base class for SerializedAbstractClosure and
SerializedTopLevelCodeDecl, most clients are
interested in the concrete kinds, not only whether
the context is serialized.
2024-01-18 12:03:52 +00:00
Allan Shortlidge
064afb9d15
NFC: Ignore deprecation of asl_log in SourceKit.
...
ASL is deprecated in macOS 10.12. It may be time to transition to os_log now
that deployment targets have been raised to 10.12, but until that project
starts these warnings are just pollution.
Filed rdar://121076739 to track adoption of `os_log()` if appropriate.
2024-01-16 14:21:36 -08:00
Ikko Eltociear Ashimine
a1108fffe9
[SourceKit] fix typo in SwiftEditor.cpp
...
clearning -> clearing
2024-01-16 03:52:03 +09:00
Sam Kortekaas
1fe5f04574
[SourceKit] Use req options instead of compiler arguments for controlling index-to-store behavior
2024-01-11 17:13:03 +01:00
Pavel Yaskevich
d61eac29d8
Merge pull request #70613 from honghoker/fix-typo
...
Fix typo whiteSpace between line comment
2024-01-08 09:17:32 -08:00
Ben Barham
f3426eb8a6
[Completion] Use statically-known size for completion ordering
...
We know the size of these arrays statically, there's no point
calculating them at runtime.
Resolves rdar://119938834.
2024-01-02 17:44:09 -08:00
honghoker
2fdb8b0481
Fix typo whiteSpace between line comment
2023-12-24 00:05:57 +09:00
Saleem Abdulrasool
9b058d8bda
SourceKit: remove unncessary link against libcmark-gfm_static
...
There is no use of cmark in SourceKit, if there is a dependency on it
for a dependent library, we should propagate it through the dependency.
2023-12-21 09:05:44 -08:00
Alex Hoppen
e8d148ab86
[build] Move addition of SWIFT_BUILD_SWIFT_SYNTAX preprocessor flag to top-level CMakeLists.txt
2023-12-12 12:58:15 -08:00
Alex Hoppen
9219b0cd71
[SourceKit] Address FIXMEs for the NameMatcher
...
rdar://118996561
2023-12-11 16:56:01 -08:00
Alex Hoppen
2e806b16e3
[SourceKit] Return operator results from related identifiers request
2023-12-07 13:12:12 -08:00
Alex Hoppen
a24c563d70
[SourceKit] Allow references to non-editable base names to be returned by the related identifiers request
...
While we don't want to return non-editable base names for Edit-All-In-Scope, we do want to return them if the related identifiers response is used as the input for find-syntactic-rename-ranges.
2023-12-07 13:12:12 -08:00
Alex Hoppen
ddf4a2e3fb
[SourceKit] Return the old name from the related identifiers response
2023-12-07 13:12:11 -08:00
Alex Hoppen
143dccbdf5
[SourceKit] Return RenameLocUsage in related identifiers response
...
This will allow us to get syntactic rename ranges from the locations returned by related identifiers.
2023-12-07 09:04:24 -08:00
Alex Hoppen
847671b6ac
[SourceKit] Fix a build failure if SWIFT_BUILD_SWIFT_SYNTAX is not set
2023-12-07 09:03:10 -08:00
Alex Hoppen
222739a71d
Merge pull request #70255 from ahoppen/ahoppen/rename-refactoring
...
[Rename] Collection of improvements to make syntactic rename easier to read
2023-12-06 19:46:01 -08:00
Alex Hoppen
e538a5ed61
[SourceKit] Merge RenameLoc and RenameLocation
...
It’s easier to understand the code if we don’t have these two nearly, but not quite, identical types.
2023-12-06 14:33:14 -08:00
Alex Hoppen
d4ee4fa308
[SourceKit] Refactor RelatedIdentsInfo
...
Remove unnecessary `ArrayRef` wrapping and introduce a struct instead of a `std::pair`.
2023-12-06 14:32:13 -08:00
Doug Gregor
fbd5cb42cd
Merge pull request #70247 from DougGregor/body-macro-as-brace-stmt
...
Macro expansion refactoring for preamble and body macros
2023-12-05 21:47:05 -08:00
Alex Hoppen
db8ca19a24
Merge pull request #70014 from ahoppen/ahoppen/some-any-completion
...
[CodeCompletion] Add keyword completion for 'some', 'any', 'repeat', and 'each'
2023-12-05 16:24:05 -08:00
Doug Gregor
2b7c70997b
Macro expansion refactoring for preamble and body macros
2023-12-05 13:30:35 -08:00
Hamish Knight
c882552426
Merge pull request #70204 from hamishknight/ast-for-lldb
...
[cmake] Fix LLDB for ASTGen
2023-12-05 18:23:55 +00:00
Hamish Knight
73c6dcb551
[cmake] Fix LLDB for ASTGen
...
Add the swiftmodule paths for ASTGen via
`-add_ast_path` to the public linker flags such
that downstream linking picks them up, allowing
LLDB to load them when debugging. Also switch
SwiftCompilerModules to using public linker
flags instead of adding the linker flags in
`_add_swift_runtime_link_flags`.
2023-12-05 12:43:25 +00:00
Alex Hoppen
a710111001
[SourceKit] Support building sourcekitd without building swift-syntax
...
This allows building sourcekitd and swift-refactor with `SWIFT_BUILD_SWIFT_SYNTAX=NO`. In these builds, the `relatedidents` and `find-syntactic-rename-ranges` requests will always return an error.
2023-12-04 19:14:01 -08:00
Alex Hoppen
9cb2a248c6
[CodeCompletion] Add keyword completion for 'some', 'any', 'repeat', and 'each'
...
The implementation is not 100% perfect but I don’t think it’s worth putting too much effort into it passing more information down in the parser if 'repeat' and 'each' are valid if we are going to remove the current parser anyway.
rdar://95725895
2023-12-04 15:20:05 -08:00
Alex Hoppen
f408619ddc
Address Hamish’s review comments
2023-11-27 14:17:04 -08:00
Alex Hoppen
1047328b63
[SourceKit] Lowercase members of ResolvedLoc
...
This type will get exposed to Swift and the members should be lowercase so that they read nicely in Swift.
2023-11-16 16:05:08 -08:00
Alex Hoppen
899368037c
[SourceKit] Return results from rename using return values instead of consumers
...
This makes it a lot easier to follow the code.
2023-11-16 16:05:08 -08:00
Alex Hoppen
d9eef8c229
[SourceKit] Remove IsNonProtocolType parameter from rename locations
...
The parameter was never checked anywhere.
2023-11-16 16:05:07 -08:00
Alex Hoppen
d095d0a186
[SourceKit] Remove newName from RenameLoc
...
We should (and do) have one new name for the entire rename operation, not a separate new name for different positions at which the renamed symbol occurs.
2023-11-16 16:05:07 -08:00
Alex Hoppen
bc3c8fc47a
[SourceKit] In related identifiers, directly construct an array of ranges instead of putting them in an array first
...
After implementing related identifiers in terms of rename, this step seems to no longer be necessary.
2023-11-16 16:05:07 -08:00
Alex Hoppen
ada3076628
[SourceKit] Share implemention of local rename and related idents
...
Local rename and related identifiers were sufficiently similar that we can implement related identifiers in terms of local rename.
2023-11-16 16:05:07 -08:00
Alex Hoppen
9ccb2ef65c
Merge pull request #69784 from ahoppen/ahoppen/remove-syntacticrename
...
Remove the `source.request.syntacticrename` request
2023-11-14 14:14:07 -08:00
Doug Gregor
89bda715ce
Merge pull request #69840 from DougGregor/macro-role-metaprogramming
...
[Macros] Macro-metaprogram macro roles
2023-11-14 11:51:50 -08:00
Doug Gregor
ffa5ba7ce3
More macro metaprogramming for macro roles
2023-11-14 09:20:15 -08:00
Doug Gregor
b53026d8d4
[Macros] Macro-metaprogram macro roles
...
Introduce X-macros for the various macro roles, and use them to
macro-metaprogram a lot of boilerplate involved with introducing new
macro roles.
2023-11-13 22:37:54 -08:00
Alex Hoppen
b598baf7f8
Merge pull request #69783 from ahoppen/ahoppen/rename-cleanup-1
...
Remove two pImpl abstraction layers in rename
2023-11-13 14:58:05 -08:00