Commit Graph

6605 Commits

Author SHA1 Message Date
Rintaro Ishizaki
8fdc4cc225 [AST] Split Attr.def to DeclAttr.def and TypeAttr.def 2024-02-02 09:36:49 -08:00
Rintaro Ishizaki
b839718351 [AST] Use scoped enum for attribute kinds
Align with other kind enum e.g. DeclKind.
2024-02-02 09:36:48 -08:00
Saleem Abdulrasool
9c3d8dfef7 Merge pull request #71324 from compnerd/refactoring
tools: demote swift-refactor to testing
2024-02-02 08:03:50 -08:00
Saleem Abdulrasool
c3d79f9178 tools: demote swift-refactor to testing
This is not currently shipped with the toolchain and is meant for
testing purposes. Mark the component as testing-tools.
2024-02-01 15:09:32 -08:00
Slava Pestov
2de4f778c9 swift-ide-test: Enable Feature::NoncopyableGenerics when built with SWIFT_ENABLE_EXPERIMENTAL_NONCOPYABLE_GENERICS 2024-02-01 17:17:43 -05:00
Steven Wu
bc8efec4f4 Merge pull request #71257 from cachemeifyoucan/eng/PR-121944849
[libSwiftScan][Caching] Add APIs to manage CAS size
2024-01-31 12:33:25 -08:00
Hamish Knight
27c08b130a Merge pull request #71123 from hamishknight/sema-expr-return
Move the single-expr return transform from Parse to Sema
2024-01-31 10:13:24 +00:00
Steven Wu
46e0f7ae19 [libSwiftScan][Caching] Add APIs to manage CAS size
Add new APIs to manage ondisk storage size used by CAS.

rdar://121944849
2024-01-30 15:30:01 -08:00
Steven Wu
e20c1b9cda Merge pull request #71066 from cachemeifyoucan/eng/PR-121291342 2024-01-30 11:08:14 -08:00
Hamish Knight
9b64990d24 [AST] Remove the "single expression body" bit
Remove this bit from function decls and closures.
Instead, for closures, infer it from the presence
of a single return or single expression AST node
in the body, which ought to be equivalent, and
automatically takes result builders into
consideration. We can also completely drop this
query from AbstractFunctionDecl, replacing it
instead with a bit on ReturnStmt.
2024-01-30 14:08:54 +00:00
Hamish Knight
f4a6b95d24 Move single-expr return transform from Parse to Sema
Rather than doing the transform in the parser, and
then potentially undoing it in Sema, move the
entire transform into Sema. This also lets us
unify the logic between function decls and
closures, and allows ASTGen to benefit from it.
2024-01-30 14:08:53 +00:00
Alex Hoppen
f0ea24dd29 [SourceKit] Fix a crash when performing related identifers request on self
Performing a related identifiers request on `self` returns an empty result because `self` is not an identifier. We thus can’t retrieve the first location to compute the old name.

rdar://121668042
2024-01-29 15:51:27 -08:00
Rick van Voorden
f8ae46b3f3 [inclusive-language] changed sanity to soundness 2024-01-25 18:18:02 -08:00
Kavon Farvardin
483b569bc8 [NCGenerics] trigger module mismatch
A swiftmodule can only be correctly ingested by a compiler
that has a matching state of using or not-using
NoncopyableGenerics.

The reason for this is fundamental: the absence of a Copyable
conformance in the swiftmodule indicates that a type is
noncopyable. Thus, if a compiler with NoncopyableGenerics
reads a swiftmodule that was not compiled with that feature,
it will think every type in that module is noncopyable.

Similarly, if a compiler with NoncopyableGenerics produces a
swiftmodule, there will be Copyable requirements on each
generic parameter that the compiler without the feature will
become confused about.

The solution here is to trigger a module mismatch, so that
the compiler re-generates the swiftmodule file using the
swiftinterface, which has been kept compatible with the compiler
regardless of whether the feature is enabled.
2024-01-23 22:42:37 -08:00
Alex Hoppen
5e803c6b6c Merge pull request #71081 from ahoppen/ahoppen/remove-call-pattern-heuristics
[CodeComplete] Remove code for call pattern heuristics and `ConjunctionElement::mightContainCodeCompletionToken`
2024-01-23 07:38:30 -08:00
Alex Hoppen
2ab9f63810 Merge pull request #71049 from ahoppen/ahoppen/dont-realpath-solver-based-cursor-info
[SourceKit] Don't realpath the primary file path
2024-01-23 07:33:18 -08:00
Alex Hoppen
c8424c1b7a [CodeComplete] Remove code for call pattern heuristics
These options weren’t used anymore, so we can remove them.
2024-01-22 19:57:12 -08:00
Alex Hoppen
8625b3f119 [SourceKit] Don't realpath the primary file path
If the file didn’t exist on disk, `fileSystem->getRealPath` returns an empty string, which means we can’t find the `InputBuffer` and thsu won’t run solver-based cursor info. There’s no reason to realpath `PrimaryInputPath`, `getMemoryBuffer` already does that.

rdar://120737244
2024-01-22 14:36:24 -08:00
Steven Wu
53239831bd [swift-scan-test] Fix the matching bracket in message
Fix a matching bracket in diagnostics.
2024-01-22 11:54:06 -08:00
Steven Wu
cf23b98ec2 [libSwiftScan] Support response file as input arguments
Build system can pass response file to libSwiftScan as the command-line
arguments. libSwiftScan needs to expand the response file before
performing tasks.

rdar://121291342
2024-01-22 11:54:06 -08:00
Hamish Knight
3f4b45b012 [AST] Remove SerializedLocalDeclContext
It's not clear that its worth keeping this as a
base class for SerializedAbstractClosure and
SerializedTopLevelCodeDecl, most clients are
interested in the concrete kinds, not only whether
the context is serialized.
2024-01-18 12:03:52 +00:00
Allan Shortlidge
064afb9d15 NFC: Ignore deprecation of asl_log in SourceKit.
ASL is deprecated in macOS 10.12. It may be time to transition to os_log now
that deployment targets have been raised to 10.12, but until that project
starts these warnings are just pollution.

Filed rdar://121076739 to track adoption of `os_log()` if appropriate.
2024-01-16 14:21:36 -08:00
Ikko Eltociear Ashimine
a1108fffe9 [SourceKit] fix typo in SwiftEditor.cpp
clearning -> clearing
2024-01-16 03:52:03 +09:00
Allan Shortlidge
e5c6bb649c Remove support for Swift 3 @objc inference.
Obsolete the `-enable-swift3-objc-inference` option and related options by
removing support for inferring `@objc` attributes using Swift 3 rules.
Automated migration from Swift 3 has not been supported by the compiler for
many years.
2024-01-11 15:40:04 -08:00
Sam Kortekaas
1fe5f04574 [SourceKit] Use req options instead of compiler arguments for controlling index-to-store behavior 2024-01-11 17:13:03 +01:00
Artem Chikin
060d82232e Merge pull request #69834 from artemcm/DefaultNewDriverSymlink
Symlink `swift` and `swiftc` to `swift-driver`, when available
2024-01-09 12:50:05 -08:00
Pavel Yaskevich
d61eac29d8 Merge pull request #70613 from honghoker/fix-typo
Fix typo whiteSpace between line comment
2024-01-08 09:17:32 -08:00
Ben Barham
d51c58a6f9 [Basic] hasFeature should succeed for promoted language features
Merge `$<Feature>` and `hasFeature` implementations.
  - `$<Feature>` did not support upcoming language features.
  - `hasFeature` did not support promoted language features and also
    didn't take into account `Options` in `Features.def`.

Remove `Options` entirely, it was always one of three cases:
  - `true`
  - `langOpts.hasFeature`
  - `hasSwiftSwiftParser`

Since `LangOptions::hasFeature` should always be used anyway, it's no
longer necessary. `hasSwiftSwiftParser` can be special cased when adding
the default promoted language features (by removing those features).

Resolves rdar://117917456.
2024-01-05 10:26:13 -08:00
Steven Wu
f232ebb286 [Caching] Don't parse LLVMArgs in cache replay instance
`llvm::cl::ParseCommandLineOptions()` is not thread-safe to be called
from libSwiftScan so replaying multiple commands in parallel can crash
the build system. Since the replay instance is not used for compilation
and only need information from command-line arguments to create outputs
and diagnostics, ignore LLVMArgs when replaying.

rdar://120423882
2024-01-04 13:31:09 -08:00
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