Commit Graph

1606 Commits

Author SHA1 Message Date
Anthony Latsis
bda6edb85c AST: Rename GenericContext::isGeneric to hasGenericParamList
`isGeneric` is a misleading name because this method checks for the
existence of a `GenericParamList`, which is not implied by genericity.
2025-11-11 15:55:16 +00:00
Alex Hoppen
893340d4f6 Merge pull request #85175 from ahoppen/swift-access-level
[Index] Record the access level of declarations in the index
2025-11-04 16:38:38 +01:00
Alex Hoppen
aa9c295ad5 [Index] Record the access level of declarations in the index
rdar://163256878
2025-10-30 14:36:29 +01:00
Becca Royal-Gordon
393965090e Merge pull request #34556 from beccadax/mod-squad-2
[SE-0491] Implement lookup and diagnostics for module selectors (MyMod::someName)
2025-10-28 16:00:26 -07:00
Allan Shortlidge
92227ad1cf AST: Introduce the Swift, anyAppleOS, and DriverKit platform kinds.
This change just stages in a few new platform kinds, without fully adding
support for them yet.

- The `Swift` platform represents availability of the Swift runtime across all
  platforms that support an ABI stable Swift runtime (see the pitch at
  https://forums.swift.org/t/pitch-swift-runtime-availability/82742).
- The `anyAppleOS` platform is an experimental platform that represents all of
  Apple's operating systems. This is intended to simplify writing availability
  for Apple's platforms by taking advantage of the new unified OS versioning
  system announced at WWDC 2025.
- The `DriverKit` platform corresponds to Apple DriverKit which is already
  supported by LLVM.
2025-10-27 19:15:04 -07:00
Becca Royal-Gordon
ffaa35810c Handle lookup into Builtin with module selector
Lookups like Builtin::Int64 were failing because BuiltinUnit rejected all unqualified lookups. Make it allow unqualified lookups with a module selector.
2025-10-24 16:23:48 -07:00
Hamish Knight
6f1417135b [SourceKit] Fix handling of @abi in AnnotatingPrinter
Make sure we avoid adding these to the entity stack entirely, which
avoids hitting the assertion that a top-level entity isn't encountered
with a non-empty stack.
2025-10-23 09:11:17 +01:00
Mads Odgaard
c92e5b47f3 Merge pull request #84574 from madsodgaard/android-availability 2025-10-20 10:40:37 +09:00
Egor Zhdan
62d388a09f Merge pull request #84435 from egorzhdan/egorzhdan/do-not-generate-interface-twice
[cxx-interop] Avoid trying to generate module interfaces twice
2025-10-07 17:50:11 +01:00
swift-ci
499f4ff714 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-29 06:15:20 -07:00
Egor Zhdan
a610bcd752 [cxx-interop] Avoid trying to generate module interfaces twice
This reverts most of 72050c5385, which led to decreased performance of jump-to-definition.

Instead of re-attempting to generate a module interface with C++ interop enabled, Swift should rely on the IDE to pass the correct `-cxx-interoperability-mode=` value to SourceKit.

rdar://149061322
2025-09-22 18:48:20 +01:00
Ahmed Mahmoud
2f6064675e [IDE] Move signature help formatting to IDE instead of SourceKit 2025-09-19 18:24:57 +03:00
swift-ci
0d2c4ca9be Merge remote-tracking branch 'origin/main' into rebranch 2025-09-15 10:29:21 -07:00
Meghana Gupta
c764244df0 Merge pull request #84180 from meg-gupta/borrowandmutatepr
Add preliminary support for borrow accessors
2025-09-15 10:01:15 -07:00
swift-ci
4c7c8c2e22 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-15 06:58:07 -07:00
Ahmed Mahmoud
7dcc341a82 [IDE] Add internal parameter names in signature help 2025-09-13 15:26:33 +03:00
Meghana Gupta
9fe489ce22 Introduce borrow and mutate as new accessor kinds
And handle them in various covered switches
2025-09-09 14:30:26 -07:00
Anthony Latsis
e1450e011e Manually merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
*	utils/build_swift/build_swift/defaults.py
2025-09-04 14:07:50 +01:00
Ahmed Elrefaey
9d1436c1c8 [IDE] [Signature Help] Add basic signature help request to SourceKit (#83378) 2025-09-04 10:09:02 +01:00
Ahmed Elrefaey
1bc96857a8 Merge pull request #82464 from a7medev/feat/full-documentation-in-code-completion
[IDE] Add full documentation to code completion result
2025-09-04 10:06:21 +01:00
swift-ci
8309156358 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-31 09:55:24 -07:00
Owen Voorhees
57062d85ae Merge pull request #84031 from owenv/owenv/sourcekit-remarks 2025-08-31 09:47:02 -07:00
Owen Voorhees
593346ab0d Include remarks in SourceKit diagnostics responses 2025-08-30 22:17:00 -07:00
swift-ci
5ed4b2a070 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-28 13:06:19 -07:00
Hamish Knight
a3edf17b24 [SourceKit] Fix assertion failure in sortTopN
With the unqualified fallback we start to hit this assertion for
`return nil` in failable intializers. We ought to be able to just
skip over literal buckets though.
2025-08-25 11:13:40 +01:00
swift-ci
5c840b6e1a Merge remote-tracking branch 'origin/main' into rebranch 2025-08-07 18:54:54 -07:00
Alex Hoppen
2d2adfb017 Merge pull request #82947 from ahoppen/compress-index
[Index] Add an option to compress the record and unit files
2025-08-07 21:12:39 +02:00
swift-ci
3998a187f9 Merge remote-tracking branch 'origin/main' into rebranch 2025-07-30 09:36:41 -07:00
Anthony Latsis
fec049e5e4 Address llvm::PointerUnion::{is,get} deprecations
These were deprecated in
https://github.com/llvm/llvm-project/pull/122623.
2025-07-29 18:37:48 +01:00
swift-ci
367f0082fc Merge remote-tracking branch 'origin/main' into rebranch 2025-07-22 22:17:45 -07:00
Anthony Latsis
2920ea84d1 Address llvm::(Mutable)ArrayRef ctor deprecations
See:
- https://github.com/llvm/llvm-project/pull/146113
- https://github.com/llvm/llvm-project/pull/146011
2025-07-21 12:36:53 +01:00
Alex Hoppen
ed3b64af2c [Index] Add an option to compress the record and unit files
Companion of https://github.com/swiftlang/llvm-project/pull/10977.
2025-07-10 15:23:51 +02:00
swift-ci
922f9bf099 Merge remote-tracking branch 'origin/main' into rebranch 2025-06-26 04:35:23 -07:00
Hamish Knight
55ef1bcaf0 [SourceKit] Print backticks if needed in printDisplayName
Ensure we print raw identifier names with backticks for e.g the
document structure request.

rdar://152524780
2025-06-25 15:15:17 +01:00
swift-ci
789bd8bd9c Merge remote-tracking branch 'origin/main' into rebranch 2025-06-19 02:17:51 -07:00
John Hui
a0d3ad7bd0 Merge pull request #82006 from j-hui/jump-to-def-for-macro-expanded-clang-imports
[SourceKit] Support location info for macro-expanded Clang imports
2025-06-19 02:01:40 -07:00
swift-ci
a626a79577 Merge remote-tracking branch 'origin/main' into rebranch 2025-06-18 20:55:46 -07:00
John Hui
6b36996081 [NFC] Refactor setLocationInfo to return LocationInfo instead 2025-06-18 02:26:15 -07:00
(null)
d6811260a9 Merge commit '665515c781999a81094bbe4f8302a7cb1a6a6b39' into mchiu/freebsd 2025-06-17 15:12:23 -04:00
John Hui
44aba1382d [SourceKit] Support location info for macro-expanded Clang imports
Currently, when we jump-to-definition for decls that are macro-expanded
from Clang imported decls (e.g., safe overloads generated by
@_SwiftifyImport), setLocationInfo() emits a bongus location pointing to
a generated buffer, leading the IDE to try to jump to a file that does
not exist.

The root cause here is that setLocationInfo() calls getOriginalRange()
(earlier, getOriginalLocation()), which was not written to account for
such cases where a macro is generated from another generated buffer
whose kind is 'AttributeFromClang'.

This patch fixes setLocationInfo() with some refactoring:

-   getOriginalRange() is inlined into setLocationInfo(), so that the
    generated buffer-handling logic is localized to that function. This
    includes how it handles buffers generated for ReplacedFunctionBody.

-   getOriginalLocation() is used in a couple of other places that only
    care about macros expanded from the same buffer (so other generated
    buffers not not relevant). This "macro-chasing" logic is simplified
    and moved from ModuleDecl::getOriginalRange() to a free-standing
    function, getMacroUnexpandedRange() (there is no reason for it to be
    a method of ModuleDecl).

-   GeneratedSourceInfo now carries an extra ClangNode field, which is
    populated by getClangSwiftAttrSourceFile() when constructing
    a generated buffer for an 'AttributeFromClang'. This could probably
    be union'ed with one or more of the other fields in the future.

rdar://151020332
2025-06-12 18:22:06 -07:00
swift-ci
161f6727b7 Merge remote-tracking branch 'origin/main' into rebranch 2025-06-05 04:53:29 -07:00
Alex Hoppen
021cdd4416 Merge pull request #81975 from ahoppen/sema-annotate-source-range 2025-06-05 13:49:54 +02:00
Alex Hoppen
c6c40de73d [IDE] Pass a SourceRange instead of a CharSourceRange in SemaAnnotator::passReference
Most `SemaAnnotator`s don’t actually care about the char source range. Instead, they only care about the start location of the reference, which is also included in `SourceRange`. Computing a `CharSourceRange` from a `SourceRange` is kind of expensive because it needs to start a new lexer.

To avoid this overhead, pass `SourceRange` to `SemaAnnotator::passReference` and related functions and let the clients compute the `CharSourceRange` when needed.

This reduces the overhead of index-while-building by about 10%.
2025-06-04 18:01:47 +02:00
Michael Chiu
7bbafc599d Merge branch 'main' into mchiu/freebsd 2025-06-02 13:33:18 -04:00
swift-ci
82545aecbb Merge remote-tracking branch 'origin/main' into rebranch 2025-05-29 12:37:25 -07:00
michael-yuji
8738e722bd Merge branch 'main' into mchiu/freebsd 2025-05-28 14:44:11 -07:00
Hamish Knight
f6c73cd178 [SourceKit] Properly handle cursor info range for macro expansions
Make `getOriginalLocation` work with source ranges, and adjust the
cursor info logic to map the range into the original buffer. This
fixes the case where we were using bogus range lengths for macro
expansion decls.

rdar://151411756
2025-05-28 18:51:40 +01:00
swift-ci
f9bf2d1715 Merge remote-tracking branch 'origin/main' into rebranch 2025-05-22 12:35:19 -07:00
michael-yuji
9a948a9c3b Merge branch 'main' into mchiu/freebsd 2025-05-21 16:29:16 -07:00
Hamish Knight
7522a3ea5b [SourceKit] Handle CustomAttrs arguments for placeholder expansion
Introduce a new ASTWalker option for walking CustomAttrs and use it
for the placeholder scanner to ensure we can expand placeholders in
attribute arguments.
2025-05-21 18:06:54 +01:00