Commit Graph

141 Commits

Author SHA1 Message Date
Alex Hoppen
a0313e3005 [SourceKit] Merge Renamer and RenameRangeDetailCollector
With `TextReplacementsRenamer` gone, `RenameRangeDetailCollector` was the only remaining subclass of `Renamer`.
2023-11-16 16:05:08 -08:00
Alex Hoppen
bfad46d524 [SourceKit] Remove the -syntactic-rename option from swift-refactor
With the local refactoring being removed, all production refactoring paths return a set of ranges to rename and don’t apply edits to the file. Thus, the `syntactic-rename` action also doesn’t make sense anymore.
2023-11-16 16:05:08 -08:00
Alex Hoppen
5d7200a0a1 [SourceKit] Remove the local rename refactoring action
Local refactoring should go through the `find-local-rename-ranges` request.
2023-11-16 16:05:08 -08:00
Alex Hoppen
8208c23850 [SourceKit] Remove ResolvedLoc.Node
We can’t represent the parent node when rewriting `NameMatcher` using swift-syntax. Replace it by two boolean fields `IsComment` and `IsInStringLiteral` that can be bridged.
2023-11-16 16:05:08 -08:00
Alex Hoppen
ba06b5c075 [SourceKit] Replace UnresolvedLoc by SourceLoc
`UnresolvedLoc` was just a wrapper around `SourceLoc` and isn’t needed anymore.
2023-11-16 16:05:08 -08:00
Alex Hoppen
b3ab9bffd5 [SourceKit] Remove UnresolvedLoc.ResolveArgLocs
AFAICT we can just infer whether to resolve arguments based on the presence of arguments. We don’t need the information to be passed in.
2023-11-16 16:05:07 -08:00
Alex Hoppen
d9eef8c229 [SourceKit] Remove IsNonProtocolType parameter from rename locations
The parameter was never checked anywhere.
2023-11-16 16:05:07 -08:00
Alex Hoppen
d095d0a186 [SourceKit] Remove newName from RenameLoc
We should (and do) have one new name for the entire rename operation, not a separate new name for different positions at which the renamed symbol occurs.
2023-11-16 16:05:07 -08:00
Alex Hoppen
ada3076628 [SourceKit] Share implemention of local rename and related idents
Local rename and related identifiers were sufficiently similar that we can implement related identifiers in terms of local rename.
2023-11-16 16:05:07 -08:00
Alex Hoppen
698397c309 [Refactoring] Expose findLocalRenameLocs in Refactoring.h 2023-11-16 16:05:07 -08:00
Alex Hoppen
e3264d9e1d [SourceKit] Remove Implementation abstraction layer in FindRenameRangesAnnotatingConsumer 2023-11-10 11:41:01 -08:00
Alex Hoppen
55b3404660 [Refactoring] Move syntactic rename to its own file 2023-09-26 20:14:22 -07:00
Alex Hoppen
dd6ddde384 [Refactoring] Move some more code from RefactoringActions.h to a .cpp file 2023-09-13 12:52:02 -07:00
Alex Hoppen
33b72bdde4 [Refactoring] Add guards around header files in lib/Refactoring 2023-09-11 19:09:56 -07:00
Alex Hoppen
755655ac00 [Refactoring] Move FindRenameRangesAnnotatingConsumer to its own file 2023-09-11 19:06:24 -07:00
Alex Hoppen
cf71a105f2 [Refactoring] Move async refactorings into their own files 2023-09-11 19:05:00 -07:00
Alex Hoppen
3074dbe5c5 [Refactoring] Move LocalRename to its own file 2023-09-11 17:14:29 -07:00
Alex Hoppen
c05c573a04 [Refactoring] Move ExpandMacro and InlineMacro to their own file 2023-09-11 17:01:58 -07:00
Alex Hoppen
10b9daf2b5 [Refactoring] Split ConvertToComputedProperty to its own file 2023-09-11 16:59:27 -07:00
Alex Hoppen
00eaf741ff [Refactoring] Move TrailingClosure to its own file 2023-09-11 16:57:26 -07:00
Alex Hoppen
c7120f466e [Refactoring] Move SimplifyNumberLiteral to its own file 2023-09-11 16:55:53 -07:00
Alex Hoppen
5dc7a79a57 [Refactoring] Move ConvertToDoCatch to its own file 2023-09-11 16:54:32 -07:00
Alex Hoppen
1be0c50acf [Refactoring] Move AddExplicitCodableImplementation to its own file 2023-09-11 16:53:00 -07:00
Alex Hoppen
fdf2586600 [Refactoring] Move AddEquatableConformance to its own file 2023-09-11 16:51:10 -07:00
Alex Hoppen
a48d0f2579 [Refactoring] Move MemberwiseInitLocalRefactoring to its own file 2023-09-11 16:45:31 -07:00
Alex Hoppen
7e87813345 [Refactoring] Move LocalizeString to its own file 2023-09-11 16:43:59 -07:00
Alex Hoppen
94ab95e8c8 [Refactoring] Move ExpandSwitchCases and ExpandDefault to their own file 2023-09-11 16:42:29 -07:00
Alex Hoppen
ef4ee95e24 [Refactoring] Move FillProtocolStubs to its own file 2023-09-11 16:38:01 -07:00
Alex Hoppen
d09be617d2 [Refactoring] Move ExpandTernaryExpr to its own file 2023-09-11 16:35:16 -07:00
Alex Hoppen
563674f888 [Refactoring] Move ExtractExpr to its own file 2023-09-11 16:32:54 -07:00
Alex Hoppen
98f40197a6 [Refactoring] Move ExtractFunction to its own file 2023-09-11 16:31:09 -07:00
Alex Hoppen
d7ada702a2 [Refactoring] Extract Renamer to its own file 2023-09-11 16:24:07 -07:00
Alex Hoppen
53694024fc [Refactoring] Move ConvertIfLetExprToGuardExpr to its own file 2023-09-11 16:04:24 -07:00
Alex Hoppen
308270c1c5 [Refactoring] Move ConvertGuardExprToIfLetExpr to its own file 2023-09-11 16:02:45 -07:00
Alex Hoppen
fc3f7a0629 [Refactoring] Move ConvertToTernaryExpr to its own file 2023-09-11 16:01:01 -07:00
Alex Hoppen
a45cd0305d [Refactoring] Move ExtractRepeatedExpr and ConvertToSwitchStmt to its own file 2023-09-11 15:59:04 -07:00
Alex Hoppen
da69dc566b [Refactoring] Move MoveMembersToExtension to a separate file 2023-09-11 15:30:10 -07:00
Alex Hoppen
514d20a665 [Refactoring] Move ReplaceBodiesWithFatalError to separate file 2023-09-11 15:27:35 -07:00
Alex Hoppen
ec71836b17 [Refactoring] Extract CollapseNestedIfStmt to its own file 2023-09-11 15:25:01 -07:00
Alex Hoppen
6b2e54dc54 Extract RefactoringActionConvertStringsConcatenationToInterpolation to its own file 2023-09-11 15:21:28 -07:00
Alex Hoppen
d5b29f2956 Split definition of refactoring actions to its own header file 2023-09-11 15:19:27 -07:00
Allan Shortlidge
0dd8f4c492 AST: Introduce abstraction for extension/type decl inheritance clauses.
Wrap the `InheritedEntry` array available on both `ExtensionDecl` and
`TypeDecl` in a new `InheritedTypes` class. This class will provide shared
conveniences for working with inherited type clauses. NFC.
2023-09-06 10:41:57 -07:00
Manu
02b5fa2c8e Fix some typos in the codebase 2023-08-31 18:50:10 -03:00
Slava Pestov
9ebb5f2e03 AST: Rename VarDecl::getType() to VarDecl::getTypeInContext()
This is a futile attempt to discourage future use of getType() by
giving it a "scary" name.

We want people to use getInterfaceType() like with the other decl kinds.
2023-08-04 14:19:25 -04:00
Holly Borla
c3e214cbde [Macros] Expand conformance macros as extension macros.
ConformanceMacro now refines ExtensionMacro, so these roles can share
the same expansion request.
2023-06-30 14:25:14 -07:00
Holly Borla
725374e0d8 [Macros] Implement attached extension macros. 2023-06-27 21:22:12 -07:00
Evan Wilde
250082df25 [NFC] Reformat all the LLVMs
Reformatting everything now that we have `llvm` namespaces. I've
separated this from the main commit to help manage merge-conflicts and
for making it a bit easier to read the mega-patch.
2023-06-27 09:03:52 -07:00
Evan Wilde
f3ff561c6f [NFC] add llvm namespace to Optional and None
This is phase-1 of switching from llvm::Optional to std::optional in the
next rebranch. llvm::Optional was removed from upstream LLVM, so we need
to migrate off rather soon. On Darwin, std::optional, and llvm::Optional
have the same layout, so we don't need to be as concerned about ABI
beyond the name mangling. `llvm::Optional` is only returned from one
function in
```
getStandardTypeSubst(StringRef TypeName,
                     bool allowConcurrencyManglings);
```
It's the return value, so it should not impact the mangling of the
function, and the layout is the same as `std::optional`, so it should be
mostly okay. This function doesn't appear to have users, and the ABI was
already broken 2 years ago for concurrency and no one seemed to notice
so this should be "okay".

I'm doing the migration incrementally so that folks working on main can
cherry-pick back to the release/5.9 branch. Once 5.9 is done and locked
away, then we can go through and finish the replacement. Since `None`
and `Optional` show up in contexts where they are not `llvm::None` and
`llvm::Optional`, I'm preparing the work now by going through and
removing the namespace unwrapping and making the `llvm` namespace
explicit. This should make it fairly mechanical to go through and
replace llvm::Optional with std::optional, and llvm::None with
std::nullopt. It's also a change that can be brought onto the
release/5.9 with minimal impact. This should be an NFC change.
2023-06-27 09:03:52 -07:00
Doug Gregor
a1464cfc2e Correctly remove properties subsumed by init accessors from memberwise inits
The code to remove these subsumed properties was part of creating the
memberwise initializer declaration, which could lead to
inconsistencies with the newly-introduced request for gathering the
memberwise-initialized properties. Move the code into the computation
of the list of memberwise-initialized properties.

Also update a few more places that were effectively recomputing the
set of memberwise-initialized properties themselves over to the
request.
2023-06-23 11:34:54 -07:00
Doug Gregor
e89fdd3084 Requestify the computation of the list of memberwise initialized properties.
Fixes rdar://110776763, a case where initialized stored properties
introduced by peer macros weren't working alongside declared stored
properties.
2023-06-23 11:34:52 -07:00