Commit Graph

6605 Commits

Author SHA1 Message Date
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
Adrian Prantl
5ef93af269 Revert "Don't require a strict revision match in LLDB."
This reverts commit 3cc2831608.

The compiler's revision check has been relaxed since the feature was introduced
and so it's nos better to reduce the number of special code paths for LLDB in
the compiler to facilitate reasoning about it.

rdar://117824367
2023-12-06 11:14:14 -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
Alex Hoppen
c48e578a88 Merge pull request #70174 from ahoppen/ahoppen/dont-build-swift-refactor-without-swiftsyntax
[SourceKit] Support building sourcekitd without building swift-syntax
2023-12-05 08:49:20 -08: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
Rintaro Ishizaki
90d3cf51e9 [Macros/Tests] Build test plugins with the same compiler as the dylib
Sanitizer ABI are apparently not stable. We need to build the executable
with the same compiler as the linking dylib.

rdar://119141141
2023-12-04 13:38:30 -08:00
Saleem Abdulrasool
18fa46021c Merge pull request #70103 from compnerd/remote
swift-inspect: clean up some of the code in `WindowsRemoteProcess`
2023-12-03 12:23:54 -08:00
Saleem Abdulrasool
7a6c6c7eee swift-inspect: clean up some of the code in WindowsRemoteProcess
Add some vertical whitespace to the code ejection process.  Alter the
logic to clean up the memory allocation first, ignoring the error as the
subsequent run will perform a new allocation and this will leak a fixed
amount of memory without interrupting the process or use of the tool.
No longer check the exit code of the thread as that is always guaranteed
to be 0 as the module unloading path does not report any error code in
the injected code (DLL).

Use the opportunity to do some simple renaming to improve the
readability and create an overload for avoiding unnecessary ceremony
around use of a shared constant.
2023-12-02 08:56:52 -08:00
Emre Celebi
a455bb8b2e Merge pull request #70125 from w6sec/swift-inspect-oops-redo-mikes-changes
[swift-inspect] Again: Fix integer type mismatch on watchOS build.
2023-11-30 15:24:41 -08:00
Emre Celebi
6a2650371d [swift-inspect] Again: Fix integer type mismatch on watchOS build.
Redo Mike's changes which were reverted: Convert integers to to `swift_reflection_ptr_t` instead of `UInt64` since watchOS uses `UInt` as its pointer type.

rdar://118458631
2023-11-30 10:09:21 -08:00
Alex Hoppen
cc858ab253 Merge pull request #70008 from ahoppen/ahoppen/name-matcher-in-swift
Share implementation of local rename and related identifiers + implement `NameMatcher` in Swift
2023-11-30 09:37:53 -08:00
Emre Celebi
0953b1d514 [swift-inspect] Deallocate symbolicator after inspecting a process
This change deallocates the symbolicator. Added CSRelease to symbolication
extensions.
2023-11-29 17:00:30 -08:00
Emre Celebi
2a3d3cb894 Merge pull request #69916 from w6sec/swift-inspect-json
[swift-inspect] Add JSON output option for dump-generic-metadata
2023-11-29 12:00:35 -08:00
Emre Celebi
4af03a89a2 [swift-inspect] Inspect all processes and add summary option
With this change swift-inspect can inspect all processes to see if metadata allocation iteration is enabled. We also added summary option that sorts metadata to popularity.
2023-11-29 07:19:04 -08:00
Steven Wu
5ba26d714c Merge pull request #69934 from cachemeifyoucan/eng/PR-async-casid-download
[libSwiftScan][Caching] Add async download API
2023-11-28 16:01:57 -08:00
Alex Hoppen
f408619ddc Address Hamish’s review comments 2023-11-27 14:17:04 -08:00
Nuri Amari
c12b6e2bd3 Merge pull request #69970 from NuriAmari/swift-ide-test-updates
[swift-ide-test] Add -enable-upcoming-feature ImportObjcForwardDeclarations support
2023-11-27 12:50:18 -08:00
Nuri Amari
7fb7e42f37 [swift-ide-test] Tie ClangImporter fwd-decl option to chosen lang feature
Prviously swift-ide-test enabled importing of ObjC forward declarations
with the -enable-objc-forward-declarations option. The compiler enables
the same behavior via -enable-upcoming-feature.

Now that swift-ide-test also supports upcoming-features, make enabling
the ImportObjcForwardDeclarations language feature have the expected
effect in swift-ide-test.

The old flag is also removed.
2023-11-20 10:28:23 -08:00
Nuri Amari
011b669023 [swift-ide-test] Add support for -enable-upcoming-feature 2023-11-17 14:38:01 -08:00
Saleem Abdulrasool
b749f10f9f Merge pull request #69915 from compnerd/events
swift-inspect: clean up event creation on Windows
2023-11-16 18:44:20 -08:00
Emre Celebi
f0a6b02bb6 [swift-inspect] Change argument options to select between file or standard output
With this change we make --json flag to toggle between JSON and text output. If --output-file option is given, then the output stream is forwarded to the file specified.
2023-11-16 18:25:38 -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
bfad46d524 [SourceKit] Remove the -syntactic-rename option from swift-refactor
With the local refactoring being removed, all production refactoring paths return a set of ranges to rename and don’t apply edits to the file. Thus, the `syntactic-rename` action also doesn’t make sense anymore.
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
9b10ab3210 Merge pull request #69873 from ahoppen/ahoppen/cancellableresult-const
[SourceKit] Mark functions on `CancellableResult` const
2023-11-16 16:03:13 -08:00
Steven Wu
d02df13445 [libSwiftScan][Caching] Add async download API
Add a new async download API from CASID. This helps build system better
schedule the job/remove duplicated downloads, than using an opaque
cached_output handle.
2023-11-16 15:11:17 -08:00
Rintaro Ishizaki
66e44875cc Merge pull request #69838 from rintaro/astgen-regex
[ASTGen] Move regex literal parsing from SwiftCompilerSources to ASTGen
2023-11-16 13:51:43 -08:00
Saleem Abdulrasool
d1459247d5 swift-inspect: clean up event creation on Windows
Create a Swiftier interface for `CreateEvent` from the Windows SDK and
use that to simplify the implementation of the remote process interface.
2023-11-16 12:27:01 -08:00
Emre Celebi
d9989d3e9f [swift-inspect] Add json output option for dump-generic-metadata
This change adds json output option to dump-generic-metadata for
swift-inspect.
2023-11-16 11:26:45 -08:00
Rintaro Ishizaki
47f18d492e [ASTGen] Move regex literal parsing from SwiftCompilerSources to ASTGen
ASTGen always builds with the host Swift compiler, without requiring
bootstrapping, and is enabled in more places. Move the regex literal
parsing logic there so it is enabled in more host environments, and
makes use of CMake's Swift support. Enable all of the regex literal
tests when ASTGen is built, to ensure everything is working.

Remove the "AST" and "Parse" Swift modules from SwiftCompilerSources,
because they are no longer needed.
2023-11-16 10:59:23 -08:00
Mike Ash
9477ed2626 [swift-inspect] Fix integer type mismatch on watchOS build.
Convert integers to to `swift_reflection_ptr_t` instead of `UInt64` since watchOS uses `UInt` as its pointer type.

rdar://118458631
2023-11-15 15:23:08 -05:00
Alex Hoppen
b19a7eac33 [SourceKit] Mark functions on CancellableResult const 2023-11-14 15:08:16 -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
Egor Zhdan
3ab2064d9b Merge pull request #69623 from apple/egorzhdan/using-base-cxx-method
[cxx-interop] Import using decls that expose methods from private base classes
2023-11-14 07:10:08 +01:00
Egor Zhdan
efc008a2ca [cxx-interop] Import using decls that expose methods from private base classes
If a C++ type `Derived` inherits from `Base` privately, the public methods from `Base` should not be callable on an instance of `Derived`. However, C++ supports exposing such methods via a using declaration: `using MyPrivateBase::myPublicMethod;`.

MSVC started using this feature for `std::optional` which means Swift doesn't correctly import `var pointee: Pointee` for instantiations of `std::optional` on Windows. This prevents the automatic conformance to `CxxOptional` from being synthesized.

 rdar://114282353 / resolves https://github.com/apple/swift/issues/68068
2023-11-14 00:30:54 +00: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
Alex Hoppen
4c1d875cf8 Remove the syntacticrename request
`source.request.find-syntactic-rename-ranges` should be used instead.
2023-11-10 11:46:47 -08:00
Alex Hoppen
e6deb0b84b [SourceKit] Remove pImpl abstraction pattern for RequestRenameRangeConsumer 2023-11-10 11:41:01 -08:00