Commit Graph

6605 Commits

Author SHA1 Message Date
Doug Gregor
642d0e9d36 [SourceKit] Disable optimization that's now incorrect with macros.
No test case at the moment, but it's pretty crashy here in practice :)
2023-02-11 19:56:07 -08:00
swift-ci
8c038a1802 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-11 15:34:18 -08:00
Doug Gregor
7ea0e3f096 Switch GeneratedSourceInfo ranges over to CharSourceRange.
Macro expansion buffers, along with other generated source buffers,
need more precise "original source ranges" that can be had with the
token-based `SourceRange`. Switch over to `CharSourceRange` and provide
more thoughtfully-determined original source ranges.
2023-02-11 11:23:26 -08:00
swift-ci
ff3132c75c Merge remote-tracking branch 'origin/main' into rebranch 2023-02-10 07:55:59 -08:00
Alex Hoppen
fd039f4344 Merge pull request #62478 from ahoppen/ahoppen/solver-based-cursor-info
[CursorInfo] Implement a few expression references as solver-based
2023-02-10 16:49:37 +01:00
Ben Barham
6269643b4d [Index] Prevent re-indexing system modules repeatedly
If a module was first read using the adjacent swiftmodule and then
reloaded using the swiftinterface, we would do an up to date check on
the adjacent module but write out the unit using the swiftinterface.
This would cause the same modules to be indexed repeatedly for the first
invocation using a new SDK. On the next run we would instead raad the
swiftmodule from the cache and thus the out of date check would match
up.

The impact of this varies depending on the size of the module graph in
the initial compilation and the number of jobs started at the same time.
Each SDK dependency is re-indexed *and* reloaded, which is a drain on
both CPU and memory. Thus, if many jobs are initially started and
they're all going down this path, it can cause the system to run out of
memory very quickly.

Resolves rdar://103119964.
2023-02-09 11:49:13 -08:00
swift-ci
ff1899f6ec Merge remote-tracking branch 'origin/main' into rebranch 2023-02-09 09:33:22 -08:00
Pavel Yaskevich
e0bf2ff854 [SIL/DI] NFC: Remove TypeWrappers feature functionality 2023-02-08 10:14:29 -08:00
Alex Hoppen
fcc5d98f1c [CursorInfo] Deliver results from solver-based cursor info
Running the SourceKit stress tester with verification of solver-based cursor info returned quite a few differences but in all of them, the old AST-based implementation was actually incorrect. So, instead of verifying  the results, deliver the results from solver-baesd cursor info and only fall back to AST-based cursor info if the solver-based implementation returned no results.

rdar://103369449
2023-02-07 14:53:54 +01:00
Alex Hoppen
6ee695a395 [CursorInfo] Implement a few expression references as solver-based
This implements cursor info resolving for a few expression types using the constraint system. This allows us to detect ambiguous results – we cannot deliver them yet but that will be done in a follow-up PR.
2023-02-07 10:42:00 +01:00
swift-ci
1a8ead7280 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-06 05:53:34 -08:00
Alex Hoppen
a5f85ee10c [SourceKit] Make sure we reuse ASTContext in function bodies for solver-based cursor info
The main problem that prevented us from reusing the ASTContext was that we weren’t remapping the `LocToResolve` in the temporary buffer that only contains the re-parsed function back to the original buffer. Thus `NodeFinder` couldn’t find the node that we want to get cursor info for.

Getting AST reuse to work for top-level items is harder because it currently heavily relies on the `HasCodeCompletion` state being set on the parser result. I’ll try that in a follow-up PR.

rdar://103251263
2023-02-02 22:03:25 +01:00
Alex Hoppen
ac3f9f85a0 [sourcekitd-test] Don't cache memory buffers
If we cache the buffers between multiple requests we don’t pick up if the source file has changed on disk since we last read it.
2023-02-02 22:03:25 +01:00
Alex Hoppen
d87700d746 [sourcekitd-test] Flush stdout and stderr before executing a shell command
Otherwise the order of sourcekitd-test’s output and the shell command is undefined.
2023-02-02 22:03:25 +01:00
Alex Hoppen
04d44bfc04 [SourceKit] Sort ReferencedDecls when printing them
This assures stable sort order when comparing solver-based and AST-based results.
2023-02-02 22:03:25 +01:00
swift-ci
ca7768ea0a Merge remote-tracking branch 'origin/main' into rebranch 2023-02-01 23:53:39 -08:00
Alex Hoppen
8f87047353 Merge pull request #62576 from ahoppen/ahoppen/only-verify-cursor-info-if-requested
[SourceKit] Only verify the solver-based cursor info implementation if requested
2023-02-02 08:41:29 +01:00
swift-ci
9fd0ce37f4 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-01 18:53:37 -08:00
Doug Gregor
f8d78e2eb9 Handle demangling prefix @__swiftmacro_ used for filenames. 2023-02-01 09:20:46 -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
4f70a7676b Merge pull request #63167 from bnbarham/fix-shadowed-rename
[Index] Handle shorthand if let/closure captures in local rename
2023-01-25 09:11:55 -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
Erik Eckstein
87ed8b4dc3 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-24 08:58:16 +01:00
Artem Chikin
eecde02dde Merge pull request #63132 from artemcm/LibSwiftScanTargetInfoV2
[libSwiftScan] Add V2 target info query API that takes compiler executable path as parameter
2023-01-23 12:34:49 -08:00
Artem Chikin
1b4bc33e68 [libSwiftScan] Add V2 target info query API that takes compiler executable path as parameter
This new version takes the path to the compiler executable as a parameter, in order for libSwiftScan to compute compiler-relative portions of runtimeLibraryPaths, runtimeResourcePath. V1, without knowing the path to the compiler executable, produced incomplete sets of these paths.
2023-01-23 09:39:46 -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
Rintaro Ishizaki
32057c5091 Merge pull request #63111 from rintaro/sourcektid-mangling-langsupport
[SourceKit] Move demangle/mangle logic to SwfitLangSupport
2023-01-20 09:42:02 -08:00
swift-ci
e72e4d36e1 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-20 09:27:31 -08:00
Artem Chikin
30891cc6e8 Merge pull request #63098 from artemcm/LibSwiftScanDisposeString
[Dependency Scanning] Provide libSwiftScan API to dispose of a string result
2023-01-20 09:23:26 -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
Artem Chikin
5ac9d5b35f [Dependency Scanning] Provide libSwiftScan API to dispose of a string ref
Previously no API returned a raw 'swiftscan_string_ref_t' directly so this was not needed.
However, 'swiftscan_compiler_target_info_query' returns a string directly, which the clients need to clean up.
2023-01-18 16:33:06 -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
ee3bb6f53b Merge remote-tracking branch 'origin/main' into rebranch 2023-01-17 09:54:32 -08:00
Artem Chikin
d95cb951ae Set install path of libSwiftScan to 'lib/swift/host' instead of platform-specific path string 2023-01-13 15:25:41 -08:00
swift-ci
a7e782f78b Merge remote-tracking branch 'origin/main' into rebranch 2023-01-11 10:24:35 -08:00
John McCall
ab80087993 Add support for -enable-experimental-feature to sil-opt 2023-01-11 03:11:15 -05:00
Erik Eckstein
712fd7922b Merge remote-tracking branch 'origin/main' into rebranch 2023-01-09 08:48:47 +01:00
Alexis Laferrière
4e69160b92 Merge pull request #62886 from xymus/deser-safety-infra
[Serialization] Prepare the infrastructure for the deserialization safety feature
2023-01-06 21:08:24 -08:00
Alexis Laferrière
940b7d99d1 [Tools] Explicitly disable deserialization safety in some testing tools 2023-01-06 12:02:47 -08:00
Alejandro Alonso
382510fa50 Rename Reflection library to RemoteInspection (#62846) 2023-01-06 13:21:32 -05: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