Commit Graph

1539 Commits

Author SHA1 Message Date
Slava Pestov
375363a473 AST: Move global conformance lookup entry points to ConformanceLookup.h 2024-08-08 23:35:58 -04:00
swift-ci
1df4bb130e Merge remote-tracking branch 'origin/main' into rebranch 2024-07-29 15:54:29 -07:00
Alex Hoppen
c5e201dd07 Merge pull request #75490 from ahoppen/swiftparser-on-deep-stack
[SourceKit] Run SwiftParser on a deep stack for the related identifiers request
2024-07-29 15:52:43 -07:00
Alex Hoppen
3bffa7970d [SourceKit] Run SwiftParser on a deep stack for the related identifiers request
We ran SwiftParser in `handlePrimaryAST` for related identifiers. That function is called on a dispatch queue with reduced stack size and could cause the parser to stack overflow if the program is very nested.

Run `handlePrimaryAST` on a deep stack for this request to fix the issue.

rdar://129960285
2024-07-25 16:57:08 -07:00
swift-ci
deb4d86f60 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-11 16:35:36 -07:00
Alexander Cyon
4a2942bb4e Fix typos in: cmake, tools, utils, unittests, validation-test
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
2024-07-12 02:34:00 +03:00
swift-ci
b7921a8232 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-06 14:34:09 -07:00
Slava Pestov
fae01d9776 AST: Remove ModuleDecl parameter from more places 2024-07-06 12:05:46 -04:00
Ben Barham
aa7a3a8268 Cleanup std includes
Remove `deque` from files it isn't actually used in. Add it and `stack`
to files that it is - presumably they were previously transitively found
through other includes.
2024-07-02 16:13:49 -07:00
Ben Barham
226ba82525 [ClangImporter] Add various const
`getSelector` now takes a `const clang::IdentifierInfo *` `ArrayRef`.
Sprinkle a bunch of `const`s in.
2024-07-02 16:13:49 -07:00
swift-ci
af298765fe Merge remote-tracking branch 'origin/main' into rebranch 2024-06-18 13:14:10 -07:00
Hamish Knight
af0062725e [Completion] Complete ownership specifiers in parameters
Complete ownership specifiers such as `consuming`,
`borrowing`, and `inout` in parameter type
position. While here, also complete `isolated`.

rdar://127261573
2024-06-12 13:36:07 +01:00
swift-ci
8158d75fe4 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-10 17:35:42 -07:00
Holly Borla
5da7ac6cbd [NFC] Use DeclAttributes::isDeprecated in a few more places. 2024-06-10 07:16:44 -07:00
swift-ci
ac43224e86 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-20 13:24:24 -07:00
Rintaro Ishizaki
39d633f5a8 [CodeCompletion] Remove unused 'isAsync' flag from CodeCompletionResult 2024-05-15 13:43:19 -07:00
swift-ci
f28f34bb81 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-03 10:15:11 -07:00
Rintaro Ishizaki
6264792d19 [SourceKit] Don't use SourceEntitityWalker for placeholder expansion
Placeholder expansion should be a syntactic operation, but
`SourceEntityWalker` can invoke type checking operations, which causes
unexpected bahaviors including crashes.

rdar://121360941`
2024-05-02 11:52:13 -07:00
swift-ci
c8d364261c Merge remote-tracking branch 'origin/main' into rebranch 2024-05-01 16:55:47 -07:00
Slava Pestov
fda93680df Merge pull request #73363 from slavapestov/pack-expansion-closures-part-2
Extract common code for building opened existential and element signatures
2024-05-01 19:44:05 -04:00
Slava Pestov
3b2a6d8c1a SourceKit: Use getNextDepth()/getMaxDepth() 2024-05-01 12:09:01 -04:00
swift-ci
22d81cbbd2 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-01 04:14:10 -07:00
Hamish Knight
de9806e2fa [SourceKit] Introduce key for cancelling on close
Defaults to `true`.
2024-04-30 21:13:20 +01:00
Hamish Knight
69f2e26d35 [SourceKit] Cancel in-flight builds on editor.close
When closing a document, cancel any in-flight
builds happening for it.

rdar://127126348
2024-04-30 12:00:27 +01:00
Hamish Knight
572fc4eae0 [SourceKit] Ensure ASTCache is guarded by mutex
There were a couple of accesses not guarded by
`CacheMtx`, introduce a couple of methods that
guard them, renaming `getASTProducer` while here.

Also make sure we don't ever insert a producer
after it has been purposefully removed by e.g a
close that removes the cached AST.
2024-04-30 12:00:27 +01:00
Nate Chandler
c43f87101f Merge branch 'main' into rebranch
Conflicts:
      lib/Basic/Platform.cpp

```
diff --git a/lib/Basic/Platform.cpp b/lib/Basic/Platform.cpp
index 240edfa144a..1797c87635f 100644
--- a/lib/Basic/Platform.cpp
+++ b/lib/Basic/Platform.cpp
@@ -200,10 +200,7 @@ StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
   case llvm::Triple::CUDA:
   case llvm::Triple::DragonFly:
   case llvm::Triple::DriverKit:
-<<<<<<< HEAD
   case llvm::Triple::ELFIAMCU:
-=======
->>>>>>> main
   case llvm::Triple::Emscripten:
   case llvm::Triple::Fuchsia:
   case llvm::Triple::HermitCore:
```
2024-04-17 13:32:48 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Ben Barham
a9077d7129 FileEntry to FileEntryRef updates 2024-04-08 08:58:58 -07:00
Ben Barham
1fdda023b3 Rename StringRef::endswith references to StringRef::ends_with
Missed this when doing the `startswith` renaming. `endswith` has also
been deprecated upstream (and presumably soon to be removed).
2024-04-01 10:59:16 -07:00
Konrad `ktoso` Malawski
6132386371 [Distributed] Complete handling of protocol calls and witnesses using adjusted mangling scheme (#72416) 2024-03-23 23:54:23 +09:00
Alex Hoppen
ef3e1c1d4f [SourceKit] Allow generation of cursor info for declarations from solutions that haven’t aren’t applied to the AST ye
This has two benefits:
1. We can now report ambiguous variable types
2. We are more robust in the generation of results for declarations inside closures. If the closure has an error, we won’t apply the solution to the AST and thus any cursor info that tried to get types out of the AST would fail.

rdar://123845208
2024-03-20 14:52:39 +01:00
Rintaro Ishizaki
91dc6822fa Merge pull request #72310 from rintaro/ifconfigregisons-per-clause
[SourceKit] Use recorded #if regions in 'active-regions' request
2024-03-15 06:22:51 +09:00
Ben Barham
9779c18da3 Rename startswith to starts_with
LLVM is presumably moving towards `std::string_view` -
`StringRef::startswith` is deprecated on tip. `SmallString::startswith`
was just renamed there (maybe with some small deprecation inbetween, but
if so, we've missed it).

The `SmallString::startswith` references were moved to
`.str().starts_with()`, rather than adding the `starts_with` on
`stable/20230725` as we only had a few of them. Open to switching that
over if anyone feels strongly though.
2024-03-13 22:25:47 -07:00
Rintaro Ishizaki
2abddcb260 [SourceKit] Use recored #if regions in "active regions" request
* Record each IfConfig clause location info in SourceFile
* Update SILProfiler to handle them
* Update SwiftLangSupport::findActiveRegionsInFile() to use the recorded
  regions instead of walking into AST to find #if regions

rdar://118082146
2024-03-14 08:52:57 +09:00
Slava Pestov
a535948e3b AST/SourceKit: Fix printing of inheritance clauses (sort of)
This still needs a lot more cleanup.
2024-03-01 12:19:15 -05:00
Ben Barham
1306f2b32a Merge pull request #71863 from bnbarham/remove-makearrayref
Use the new template deduction guides rather than `makeArrayRef`
2024-02-25 21:06:51 -08:00
Alex Hoppen
873ed19786 [SourceKit] Add the raw doc comment to the cursor info response
SourceKit-LSP currently parses the XML comment to generate Markdown again but round-tripping a (probably markdown) doc comment to XML to Markdown is lossy in many cases and unnecessary work. Include the comment as it is spelled in source in the cursor info response so that sourcekit-lsp can display it.

Part of rdar://120685874
2024-02-24 08:41:08 -08:00
Ben Barham
f292ec9784 Use the new template deduction guides rather than makeArrayRef
LLVM has removed `make*ArrayRef`, migrate all references to their
constructor equivalent.
2024-02-23 20:04:51 -08:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Ben Barham
0755fd3259 Merge pull request #69076 from barinsim/local-symbols
[SourceKit] Add option to index local symbols to IndexSource request
2024-02-20 14:54:07 -08:00
Apollo Zhu
f003c49fdf [WIP] Disallow macro default argument with argument
Need to use variable from caller side context
2024-02-06 15:02:12 -08:00
Konrad `ktoso` Malawski
5acd366c98 [macros] allow forwarding generic arguments through macro declarations (#71271)
* [macros] allow forwarding generic arguments through macro declarations

[macros] add more tests for generic argument forwarding in macro declarations

* [macros] correct replacement picking logic
2024-02-06 03:56:20 -08:00
Hamish Knight
16cfca4186 [ASTWalker] NFC: Rename SkipChildren -> SkipNode
This better describes what the action currently
does, and allows us to re-introduce `SkipChildren`
with the correct behavior.
2024-02-05 15:27:25 +00:00
Rintaro Ishizaki
92e70ef80a [AST] Remove DeclAttrKind::Count
Introduce NumDeclAttrKinds for number of enum values. Use optional for
invalid attribute kind. This align with `TypeAttrKind`.
2024-02-02 09:36:49 -08:00
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
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
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