Commit Graph

6326 Commits

Author SHA1 Message Date
Steven Wu
e2f888b311 Merge pull request #70384 from cachemeifyoucan/eng/PR-119387650
[Caching] Encoding cache key for input file with index instead of path
2024-01-04 12:04:25 -08:00
Rintaro Ishizaki
a8ae8e4b8c [CodeCompletion] Check if stdlib decls exist
In some configurations e.g. 'Embedded', some stdlib types don't exist.
We cannot just assume they are always available.

rdar://119691781
2024-01-03 16:31:10 -08:00
Artem Chikin
6a181fb04c Add symlinks for the legacy driver invocation (for emergency fallback invoked from 'swift-driver') 2024-01-03 14:12:22 -08:00
Artem Chikin
7f6152ac7f Install host-built 'swift-driver' and 'swift-help' when installing the 'compiler' component 2024-01-03 14:12:22 -08:00
Artem Chikin
f85b1806b2 Symlink 'swift' and 'swiftc' to 'swift-driver', when available 2024-01-03 14:12:22 -08:00
Artem Chikin
f7c3f5a65c Remove redundant calls to 'add_swift_tool_symlink' on bin executables of the driver CMake target 2024-01-03 14:12:22 -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
Steven Wu
76bde39ee7 [Caching] Encoding cache key for input file with index instead of path
Avoid path encoding difference (for example, real_path vs. path from
symlink) by eliminating the path from cache key. Cache key is now
encoded with the index of the input file from all the input files from
the command-line, reguardless if those inputs will produce output or
not. This is to ensure stable ordering even the batching is different.

Add a new cache computation API that is preferred for using input index
directly. Old API for cache key is deprecated but still updated to
fallback to real_path comparsion if needed.

As a result of swift scan API change, rename the feature in JSON file to
avoid version confusion between swift-driver and libSwiftScan.

rdar://119387650
2023-12-18 14:06:00 -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
c7f32a31a4 Merge pull request #70287 from ahoppen/ahoppen/related-identifiers-for-rename
[SourceKit] Update related identifiers request to serve local rename
2023-12-08 14:55:31 -08:00
Adrian Prantl
3b38e15427 Merge pull request #70274 from adrian-prantl/117824367
Revert "Don't require a strict revision match in LLDB."
2023-12-08 13:23:44 -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
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