Commit Graph

2350 Commits

Author SHA1 Message Date
swift-ci
ca7768ea0a Merge remote-tracking branch 'origin/main' into rebranch 2023-02-01 23:53:39 -08:00
Alex Hoppen
7811519152 [SourceKit] Only verify the solver-based cursor info implementation if requested
This allows us to mark expected deviations between the AST-based and the solver-based implementation in the stress tester as XFails without breaking actual clients

We always verify if a cursor info request is issued through `sourcekitd-test`.
2023-01-31 21:25:51 +01:00
swift-ci
791d160814 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-26 10:34:25 -08:00
Ben Barham
3ec878d918 Update llvm::Optional API uses
Use the std-equivalent names as the LLVM ones are now deprecated
(eventually `llvm::Optional` will disappear):
  - `getValue` -> `value`
  - `getValueOr` -> `value_or`
  - `hasValue` -> `has_value`

Follow up from ab1b343dad and
7d8bf37e5e with some missing cases.
2023-01-25 16:28:10 -08:00
swift-ci
e0b16dbdf4 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-25 16:07:15 -08:00
Ben Barham
4cc7167b60 [Index] Handle shorthand if let/closure captures in local rename
Update rename to pull the outermost-declaration so that references are correctly found.

Rather than keeping suppressed locations in the current parent, keep
them for the whole index. Local rename starts the lookup from the
innermost context it can, which could be a closure. In that case there
is no parent decl on the stack and thus no where to store the locations
to suppress. We could have a specific store for this case, but there
shouldn't be that many of these and they're relatively cheap to store
anyway.

Resolves rdar://104568539.
2023-01-24 11:10:38 -08:00
swift-ci
2e477fd38b Merge remote-tracking branch 'origin/main' into rebranch 2023-01-20 14:13:44 -08:00
Ellie Shin
91f785441f Merge pull request #62652 from apple/es-pkg-acl
[NFC] Add 'package' access modifier to AccessLevel
2023-01-20 13:58:15 -08:00
swift-ci
9a179511d9 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-20 09:42:15 -08:00
Ellie Shin
37af51dc4c Merge branch 'main' into es-pkg-acl 2023-01-19 16:18:17 -08:00
Ellie Shin
1c66d02f92 Add package access level to enum AccessLevel
Resolves rdar://104198440
2023-01-19 15:54:18 -08:00
Rintaro Ishizaki
8d8ec09280 [SourceKit] Move demangle/mangle logic to SwfitLangSupport
'sourcekitd' itself should not call 'swift::' functions.  It should just
deserialize the request, execute the logic in LangSupport, then serialize
the result.
2023-01-19 14:45:56 -08:00
swift-ci
8c0abfce38 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-19 12:15:43 -08:00
Rintaro Ishizaki
d4a757bfb2 [SourceKit] Refactor main 'handleRequestImpl' function
Previously, SourceKit requests are handled in a single
'handleRequestImpl'/'handleSemanticRequest' with basically a giant
'if (ReqUID == RequstXXX)' branches. Some request parameters are
extracted at the top of the function, but not all request kind used all
of them.

Factor out each handling logic to its own function, and check/extract
request parameters in it. This makes it clear that which request uses
what parameters, and how they are handled.
2023-01-18 13:40:36 -08:00
swift-ci
990588a938 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-03 07:24:05 -08:00
Doug Gregor
49b42b4ef3 Handle indexing of macros 2023-01-02 21:22:05 -08:00
Valeriy Van
5878082674 Remove one of two identical cases in switch 2022-12-18 11:59:29 +02:00
swift-ci
446f63fdc1 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-13 07:53:58 -08:00
Alex Hoppen
fe2ae72ad2 [IDE] Rename CodeCompletion to IDEInspection in cases where the code path no longer exclusively applies to code completion
The code completio infrastructure is also being used for cursor info now, so it should no longer be called code completion.

rdar://103251187
2022-12-13 11:41:05 +01:00
swift-ci
80c5a0e472 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-12 03:54:02 -08:00
Alex Hoppen
d9382b1bdb Merge pull request #62362 from ahoppen/ahoppen/completion-like-cursor-info
[IDE] Implement completion-like cursor info for ValueDecls
2022-12-12 12:40:40 +01:00
swift-ci
fcdbbfe6d8 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-09 16:23:24 -08:00
Rintaro Ishizaki
d05f45b7f0 [CMake] Don't add unnecessary gyb support .py files
'add_gyb_target' can accept 'DEPENDS'. Utilize it.
2022-12-08 14:49:08 -08:00
Alex Hoppen
a8dd6819b5 [IDE] Implement completion-like cursor info for ValueDecls
This brings up the ability to compute cursor info results using the completion-like type checking paradigm, which an reuse ASTContexts and doesn’t need to type check the entire file.

For now, the new implementation only supports cursor info on `ValueDecl`s (not on references) because they were easiest to implement. More cursor info kinds are coming soon.

At the moment, we only run the new implementation in a verification mode: It is only invoked in assert toolchains and when run, we check that the results are equivalent to the old implementation. Once more cursor info kinds are implemented and if the SourceKit stress tester doesn’t find any verification issues, we can enable the new implementation, falling back to the old implementation if the new one didn’t produce any results.
2022-12-08 14:39:14 +01:00
swift-ci
d484655d3d Merge remote-tracking branch 'origin/main' into rebranch 2022-12-07 14:53:22 -08:00
Rintaro Ishizaki
31b1820322 Merge pull request #62425 from rintaro/sourcekit-macroexpand-rdar102739026
[SourceKit/Refactoring] Macro expansion
2022-12-07 14:48:35 -08:00
Rintaro Ishizaki
9f137074af [SourceKit/Refactoring] Macro expansion
Add refactoring "Expand Macro" that expands macro expressions.

rdar://102739026
2022-12-06 16:20:07 -08:00
swift-ci
663df4a9e2 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-06 15:53:28 -08:00
Rintaro Ishizaki
a28b92e7ff Merge pull request #62308 from rintaro/sourcekitd-rdar102765542
[SourceKit] Don't link 'sourcekitd' to service related code
2022-12-06 15:41:30 -08:00
swift-ci
e0abefd949 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-06 09:34:41 -08:00
Ben Barham
5b9aef91f8 Merge pull request #62416 from bnbarham/fix-sourcekit-rpath
[SourceKit] Add required rpath back to sourcekitd RPATH_LIST
2022-12-06 09:19:32 -08:00
swift-ci
40bb6d650d Merge remote-tracking branch 'origin/main' into rebranch 2022-12-05 21:53:52 -08:00
Doug Gregor
1b8b706dac Merge pull request #62405 from DougGregor/macro-diagnostics 2022-12-05 21:37:27 -08:00
Ben Barham
c8e092d078 [SourceKit] Add required rpath back to sourcekitd RPATH_LIST
This was modified to `.../swift/host` in
b338472a2b, but the SourceKit libraries
are not under `swift/host`.

Resolves rdar://103006159.
2022-12-05 20:24:49 -08:00
Doug Gregor
f0fc1c51bb Remove compiler plugin support library
The functionality of the compiler plugin support library has been
subsumed into parts of the compiler. Remove the functionality and its
last test.
2022-12-05 12:54:36 -08:00
swift-ci
4eaff05e0f Merge remote-tracking branch 'origin/main' into rebranch 2022-12-02 01:57:21 -08:00
Alex Hoppen
8e857d55c3 Merge pull request #62292 from ahoppen/ahoppen/solver-based-cursor-info-prep
[SourceKit] Preparation for solver-based cursor info
2022-12-02 10:52:30 +01:00
swift-ci
21b2cf9c50 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-01 20:14:31 -08:00
Alex Hoppen
9f6bc90d6d [SourceKit] Accept a file system in SwiftASTManager::getMemoryBuffer 2022-12-01 12:11:39 +01:00
Alex Hoppen
04ff291ae0 [SourceKit] Allow executing a completion-like operation without inserting a code completion token into the buffer
We will use this for solver-based cursor info, which doesn’t use code completion tokens.
2022-12-01 12:11:39 +01:00
Alex Hoppen
1485fe554f [SourceKit] Add print and dump methods for cursor info results
We will be using the string serialized results to verify that solver-based cursor info results match the old implementation. This is necessary because cursor info results on their own contain stack references that cannot be stored.
2022-12-01 12:11:39 +01:00
Alex Hoppen
54360ad0fb [SourceKit] Remove unused MainModule param from cursor info results 2022-12-01 12:11:39 +01:00
Alex Hoppen
652686034c [IDE] Split ResolvedCursorInfo into subclasses
This way, each kind of `ResolvedCursorInfo` can define its own set of properties and it’s obvious which properties are used for which kind. Also switch to getters and setters because that makes it easier to search for usages of properties by looking at the call hierarchy of the getter / setter.
2022-12-01 12:11:39 +01:00
Doug Gregor
b338472a2b Start building libswift_CompilerPluginSupport into lib/swift/host. 2022-11-30 13:54:03 -08:00
Doug Gregor
20013181e1 [CMake] Link to swift-syntax libriares from lib/swift/host. 2022-11-30 13:54:03 -08:00
Rintaro Ishizaki
0a791e8827 Don't link 'sourcekitd' to service related code
Separate 'sourcekitd/lib/API/Requests.cpp' to a library
'sourcekitdService' so the XPC client libary (i.e.
sourcektid.framework/sourcekid) doesn't include unnecessary code.

rdar://102765542
2022-11-30 09:06:34 -08:00
swift-ci
1acf8b039b Merge remote-tracking branch 'origin/main' into rebranch 2022-11-29 10:14:02 -08:00
Doug Gregor
af6b30a195 [Code completion] Add code completion support for macro expansions. 2022-11-28 18:33:10 -08:00
Erik Eckstein
ab1b343dad use new llvm::Optional API
`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`

The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.

rdar://102362022
2022-11-21 19:44:24 +01:00
Rintaro Ishizaki
d458c8b74a Merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
	include/swift/Sema/ConstraintSystem.h
	include/swift/Syntax/AbsoluteRawSyntax.h
	include/swift/Syntax/Syntax.h
	include/swift/Syntax/SyntaxData.h
	lib/DependencyScan/ModuleDependencyCacheSerialization.cpp
	lib/Syntax/SyntaxFactory.cpp.gyb
	lib/Syntax/SyntaxNodes.cpp.gyb
	tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp
	tools/swift-syntax-test/swift-syntax-test.cpp
2022-11-18 09:37:38 -08:00