Commit Graph

6605 Commits

Author SHA1 Message Date
swift-ci
8a3731cad8 Merge remote-tracking branch 'origin/main' into rebranch 2021-11-19 09:55:20 -08:00
Rintaro Ishizaki
86158c66dd [sourcekitd-repl] 'time' requests
When you prefix the request JSON with 'time', it will display the time
taken for the request. e.g.

  (SourceKit) time { key.request: source.request.compiler_version }
  request time: 0.177 ms
  {
    key.version_major: 5,
    key.version_minor: 6,
    key.version_patch: 0
  }
  (SourceKit)
2021-11-19 09:49:42 -08:00
Richard Wei
65bffd7ad7 Add _MatchingEngine and _StringProcessing modules.
These modules are part of the experimental declarative string processing feature. If accepted to the Standard Library, _StringProcessing will be available via implicit import just like _Concurrency, though _MatchingEngine will still be hidden as an implementation detail.

`_MatchingEngine` will contain the general-purpose pattern matching engine ISA, bytecode, and executor. `_StringProcessing` will contain regular expression and pattern matching APIs whose implementation depends on the matching engine..

Also consolidates frontend flag `-enable-experimental-regex` as `-enable-experimental-string-processing`.

Resolves rdar://85478647.
2021-11-19 09:27:33 -08:00
Saleem Abdulrasool
4d44953691 Revert "Support __available__((swift_attr("@Sendable")))" 2021-11-19 07:40:24 -08:00
swift-ci
3a5bb8b2bc Merge remote-tracking branch 'origin/main' into rebranch 2021-11-19 01:33:47 -08:00
Becca Royal-Gordon
3d2d4e1721 Merge pull request #40170 from beccadax/send-me-an-object
Support __available__((swift_attr("@Sendable")))
2021-11-19 01:26:10 -08:00
swift-ci
6efbfb5c26 Merge remote-tracking branch 'origin/main' into rebranch 2021-11-18 17:54:19 -08:00
Mike Ash
4440bd4977 Merge pull request #40055 from mikeash/swift-inspect-dump-arrays
[swift-inspect] Add a command to dump information about allocated arrays in the target process.
2021-11-18 20:50:12 -05:00
Becca Royal-Gordon
0e77d050f2 Fix swift-dependency-tool dependencies 2021-11-18 15:28:13 -08:00
Connor Wakamo
c0b5925a41 [CMake] Removed an overwrite of the SOURCEKIT_DEPLOYMENT_TARGET setting.
This setting is set early in SourceKit's CMake logic to match Swift's CMake settings.
However, it was then reset back to the empty string. The CMake logic would then see that it was unset and use the host OS as the deployment target.

Thankfully, the compiled binaries have been correct without this change, but sourcekitd.framework's Info.plist when building for iOS was incorrect.
By removing the reset, the correct value propagates to the right places.

This is for <rdar://problem/85511244> and addresses <rdar://problem/68656762>.
2021-11-17 14:58:04 -08:00
Connor Wakamo
546a646b32 [CMake] Correctly order the arguments when setting up sourcekitdInProc_Static.
The shared arguments should come first, followed by the headers.
Otherwise, things don't work correctly, and CMake thinks there are no sources in sourcekitdInProc_Static.

This is for <rdar://problem/85511244>.
2021-11-17 14:56:46 -08:00
Ben Barham
11f28196bc Merge pull request #40168 from bnbarham/rebranch-failures
[rebranch] Fix compilation failures
2021-11-17 08:50:11 +10:00
Michael Gottesman
3eba144b83 Merge pull request #40189 from gottesmm/pr-aeffd0309402b8c9a744770c71ce40ca6f0459ff
[move-operator] Specify if LexicalLifetimes is enabled using an enum instead of a bool.
2021-11-15 16:47:38 -08:00
Michael Gottesman
72eb5e2eec [move-operator] Specify if LexicalLifetimes is enabled using an enum instead of a bool.
The reason why I am doing this is that we are going to be enabling lexical
lifetimes early in the pipeline so that I can use it for the move operator's
diagnostics.

To make it easy for passes to know whether or not they should support lexical
lifetimes, I included a query on SILOptions called
supportsLexicalLifetimes. This will return true if the pass (given the passed in
option) should insert the lexical lifetime flag. This ensures that passes that
run in both pipelines (e.x.: AllocBoxToStack) know whether or not to set the
lexical lifetime flag without having to locally reason about it.

This is just chopping off layers of a larger patch I am upstreaming.

NOTE: This is technically NFC since it leaves the default alone of not inserting
lexical lifetimes at all.
2021-11-15 13:47:22 -08:00
Alex Hoppen
ac56bfb34e Merge pull request #40066 from ahoppen/pr/deep-stack
[SourceKit] Use deep stack when parsing in the XPC service
2021-11-15 09:17:03 +01:00
Artem Chikin
b10696ed5f Merge pull request #40160 from artemcm/SwiftScanTargetInfoQuery
Add `libSwiftScan` entry-point to query target info.
2021-11-13 09:16:09 -08:00
Alex Hoppen
666ea9313e [SourceKit] Add sourcekitd::disposeCancellationToken to Darwin exports
This was causing linker failures when building on Darwin with `sourcekit-inproc` in the Swift install components.

rdar://85351452
2021-11-13 10:07:55 +01:00
Ben Barham
5343c72d10 [rebranch] Fix missing includes 2021-11-13 17:04:29 +10:00
Ben Barham
c676dfc2fa [rebranch] Update uses of ErrorHandling.h functions
llvm-project `ErrorHandling.h` was updated to remove std::string. This
added a new `report_fatal_error` overload taking a `const Twine &`,
removed the overload that took `const std::string &`, and updated
`fatal_error_handler_t` to use `const char *` rather than `const
std::string &`.

Fix uses of these functions to take into account these updates. Note
that without the `const std::string &` overload, passing a `std::string`
into `report_fatal_error` now results in an ambiguous match between the
`StringRef` and `Twine` overloads so we need to be explicit about one or
the other.
2021-11-13 15:33:09 +10:00
Artem Chikin
40a1b321f5 Add libSwiftScan entry-point to query target info.
This provides the library with functionality to answer `-print-target-info` queries in place of calls to `swift-frontend`.
2021-11-12 11:01:45 -08:00
Alex Hoppen
8a6c4b338a Merge pull request #39681 from ahoppen/pr/request-tracker
[SourceKit] Add a request tracker that manages cancellation
2021-11-12 11:54:07 +01:00
Rintaro Ishizaki
73be942082 [CodeCompletion] NFC: Make enums in CodeCompletionResult scoped 2021-11-11 11:30:04 -08:00
Ben Barham
7d2ffdde4e Merge pull request #40118 from bnbarham/sk-annotator-assert
[SourceKit] Ignore references without a location
2021-11-11 11:11:26 +10:00
Alex Hoppen
c43c051046 [SourceKit] Add function to dispose a request handle
This allows the client to dispose of a request handle manually, cleaning up memory leaks that could previoulsy resulted from cancelling a request that has finished. It also gives us more flexibility to change to a different representation of request handles that require manual disposal in the future.
2021-11-11 00:02:15 +01:00
Alex Hoppen
772485def3 [SourceKit] Add a request tracker that manages cancellaiton
Previously, `SwiftASTManager` and `SlowRequestSimulator` maintained their own list of in-progress cancellation tokens. With code completion cancellation coming up, there would need to be yet another place to track in-progress requests, so let’s centralize it.

While at it, also support cancelling requests before they are scheduled, eliminating the need for a `sleep` in a test case.

The current implementaiton leaks tiny amounts of memory if a request is cancelled after if finishes. I think this is fine because it is a pretty nieche case and the leaked memory is pretty small (a `std::map` entry pointing to a `std::function` + `bool`). Alternatively, we could require the client to always dispose of the cancellation token manually.
2021-11-10 22:11:02 +01:00
Michael Gottesman
b02dc65e91 Merge pull request #40077 from gottesmm/pr-2ea314186d00544a71b7886ab6ef6743b4b560ab
[cmake] Move a bunch of test binaries from install component 'tools' -> 'testsuite-tools'.
2021-11-10 11:02:56 -08:00
Ben Barham
f6db91e3f9 [SourceKit] Ignore references without a location
A keypath using dynamic member lookup results in various `KeyPathExpr`
that have components with no location. Ignore these and any other
references that have a missing location.

Resolves rdar://85237365
2021-11-10 14:52:46 +10:00
Michael Gottesman
06cb5c0047 [cmake] Move a bunch of test binaries from install component 'tools' -> 'testsuite-tools'.
All of these are tools that are only meant to be used when testing swift. Thus
it doesn't make sense to include them in the catch all 'tools' install component
that distributions use to build all the tools.

I verified that all of the mac/linux presets in tree that have tools also has
testsuite-tools so this should be NFC. On Windows, I needed to add
testsuite-tools to build-windows.bat so should be NFC there as well.
2021-11-09 12:51:58 -08:00
Alex Hoppen
3a96cc7c51 [SourceKit] Use a deep stack to perform syntactic parsing
Othwerise we were performing the syntactic parsing on a background queue that had a reduced stack size which could result in stack overflows.

rdar://84474387
2021-11-09 18:36:09 +01:00
Alex Hoppen
86a1bfd340 Merge pull request #39631 from ahoppen/pr/cancel-completion-infrastructure
[CodeCompletion] Refactor how code completion results are returned to support cancellation
2021-11-09 13:35:18 +01:00
Erik Eckstein
581a41c377 cmake: Don’t add -lobjc in linux builds
Fixes a linux build error.
It doesn’t make sense to let add HAS_LIBSWIFT to add_swift_host_library(). This was added to work around a linker bug (d22b348adb). Instead do the workaround in libSwiftScan/CMakeLists.txt.
2021-11-09 09:16:08 +01:00
Daniel Rodríguez Troitiño
415f546cea Merge pull request #40093 from rmaz/swift_stdlib_tool_main_fix
[swift-stdlib-tool] use correct paths when codesigning
2021-11-08 19:10:46 -08:00
Ben Barham
89c9778c29 Merge pull request #40062 from bnbarham/add-synthesized-field
[CursorInfo] Add a synthesized field
2021-11-09 10:22:25 +10:00
Richard Howell
e9fe60374f [swift-stdlib-tool] use correct path when codesigning 2021-11-08 13:22:39 -08:00
Richard Howell
4fcccfd9ba [swift-stdlib-tool] fix inverted logic 2021-11-08 13:21:29 -08:00
Robert Widmann
eab562f6b3 Merge pull request #39216 from salinas-miguel/main 2021-11-06 08:50:42 -07:00
Erik Eckstein
09552abc44 libswift: improve the bootstrapping-with-hostlibs build mode
Don't build the swiftCore module files in the bootstrapping phases. Instead use the module files in the SDK.
This reduces the build time overhead from 3min -> 30seconds.
2021-11-05 18:32:25 +01:00
Ben Barham
fd7d59daa6 [CursorInfo] Add a synthesized field
Mark implicit declarations with a `synthesized` field, since while we
still want them to have a cursor info result (eg. for their USR to find
possible overrides), it's likely that clients will want to treat them
differently to results that have a real location in source.

An alternative could be to remove the location entirely, but:
  - the module name would also have to be removed to prevent wasted
    lookups in the generated interface
  - having the location could still be useful as the location that
    caused the synthesized declaration (though at the moment only
    synthesized initializers have a location)

Resolves rdar://84990655
2021-11-05 15:52:10 +10:00
Mike Ash
9fa76e2f4f [swift-inspect] Add a command to dump information about allocated arrays in the target process. 2021-11-04 16:15:15 -04:00
Miguel Salinas
1e94613fb5 Merge branch 'main' 2021-11-03 16:24:33 -07:00
Robert Widmann
2f2fc2345c Merge pull request #39996 from keith/ks/swift-stdlib-tool-add-support-for-back-deployed-concurrency
[swift-stdlib-tool] Add support for back deployed concurrency
2021-11-03 10:59:09 -07:00
Miguel Salinas
3c8bb5d51c fix formatting issues 2021-11-02 12:10:31 -07:00
Erik Eckstein
5321a7cae8 SIL: Only enable instruction leaks checking in the frontend's and SILOpt's modules.
Leaks checking is not thread safe and e.g. lldb creates multiple SILModules in multiple threads, which would result in false alarms.
Ideally we would make it thread safe, e.g. by putting the instruction counters in the SILModule, but this would be a big effort and it's not worth doing it. Leaks checking in the frontend's and SILOpt's SILModule (not including SILModules created for module interface building) is a good enough test.

rdar://84688015
2021-11-02 10:23:46 +01:00
Keith Smiley
615b1bcbde Use component prefix to add instead of specifics 2021-11-01 10:59:47 -07:00
Keith Smiley
f890e75dee [swift-stdlib-tool] Add support for back deployed concurrency
This tool was mostly already compatible with copying
`libswift_Concurrency.dylib` based on whether or not the executables it
was scanning linked it. The only thing missing was that it can now end
up copying from different source directories, the older `swift-5.0`
directory, and the new `swift-5.5` directory.

This change allows users to pass `--source-libraries` multiple times
(or picks a default with both) in order to have it scan both directories
for any libraries the app links. The biggest part of this change is
instead of storing just the library name throughout this logic we now
store the actual discovered path, so that we don't have to loop through
all potential source directories each time we need to find the library,
only the first time.
2021-10-31 21:36:41 -07:00
QuietMisdreavus
dd88e0dda6 Merge pull request #39865 from apple/QuietMisdreavus/private-swiftc-symbols
[Driver][SymbolGraph] add new flag -symbol-graph-minimum-access-level

rdar://79099869
2021-10-29 13:01:22 -06:00
Alex Hoppen
c9f5331804 [SourceKit] Pass CompletionContext by reference to CompletionInstance 2021-10-29 12:00:12 +02:00
Arnold Schwaighofer
3dfede7482 Remove fatalError calls 2021-10-28 09:18:00 -07:00
Arnold Schwaighofer
f0c864063e Print whether the metadata is a _ContiguousArrayStorage with a class element type 2021-10-28 07:59:44 -07:00
Arnold Schwaighofer
28b53dec31 Use the utility function to add the reflection info from loaded images 2021-10-28 07:58:53 -07:00