mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SourceKit/CursorInfo] Add constructor to call results
Cursor info for a constructor would previously give the cursor info for the containing type only. It now also adds cursor info for the constructor itself in a "secondary_symbols" field. Refactor `passCursorInfoForDecl` to use a single allocator rather than keeping track of positions in a buffer and assigning everything at the end of the function. Refactor the various available refactoring gathering functions to take a SmallVectorImpl and to not copy strings where they don't need to. Resolves rdar://75385556
This commit is contained in:
@@ -81,13 +81,14 @@ enum class RenameAvailableKind {
|
||||
Unavailable_decl_from_clang,
|
||||
};
|
||||
|
||||
struct RenameAvailabiliyInfo {
|
||||
struct RenameAvailabilityInfo {
|
||||
RefactoringKind Kind;
|
||||
RenameAvailableKind AvailableKind;
|
||||
RenameAvailabiliyInfo(RefactoringKind Kind, RenameAvailableKind AvailableKind) :
|
||||
Kind(Kind), AvailableKind(AvailableKind) {}
|
||||
RenameAvailabiliyInfo(RefactoringKind Kind) :
|
||||
RenameAvailabiliyInfo(Kind, RenameAvailableKind::Available) {}
|
||||
RenameAvailabilityInfo(RefactoringKind Kind,
|
||||
RenameAvailableKind AvailableKind)
|
||||
: Kind(Kind), AvailableKind(AvailableKind) {}
|
||||
RenameAvailabilityInfo(RefactoringKind Kind)
|
||||
: RenameAvailabilityInfo(Kind, RenameAvailableKind::Available) {}
|
||||
};
|
||||
|
||||
class FindRenameRangesConsumer {
|
||||
@@ -130,17 +131,14 @@ int findLocalRenameRanges(SourceFile *SF, RangeConfig Range,
|
||||
FindRenameRangesConsumer &RenameConsumer,
|
||||
DiagnosticConsumer &DiagConsumer);
|
||||
|
||||
ArrayRef<RefactoringKind>
|
||||
collectAvailableRefactorings(SourceFile *SF, RangeConfig Range,
|
||||
bool &RangeStartMayNeedRename,
|
||||
std::vector<RefactoringKind> &Scratch,
|
||||
llvm::ArrayRef<DiagnosticConsumer*> DiagConsumers);
|
||||
void collectAvailableRefactorings(
|
||||
SourceFile *SF, RangeConfig Range, bool &RangeStartMayNeedRename,
|
||||
llvm::SmallVectorImpl<RefactoringKind> &Kinds,
|
||||
llvm::ArrayRef<DiagnosticConsumer *> DiagConsumers);
|
||||
|
||||
ArrayRef<RefactoringKind>
|
||||
collectAvailableRefactorings(SourceFile *SF,
|
||||
const ResolvedCursorInfo &CursorInfo,
|
||||
std::vector<RefactoringKind> &Scratch,
|
||||
bool ExcludeRename);
|
||||
void collectAvailableRefactorings(const ResolvedCursorInfo &CursorInfo,
|
||||
llvm::SmallVectorImpl<RefactoringKind> &Kinds,
|
||||
bool ExcludeRename);
|
||||
|
||||
/// Stores information about the reference that rename availability is being
|
||||
/// queried on.
|
||||
@@ -150,10 +148,9 @@ struct RenameRefInfo {
|
||||
bool IsArgLabel; ///< Whether Loc is on an arg label, rather than base name.
|
||||
};
|
||||
|
||||
ArrayRef<RenameAvailabiliyInfo>
|
||||
collectRenameAvailabilityInfo(const ValueDecl *VD,
|
||||
Optional<RenameRefInfo> RefInfo,
|
||||
std::vector<RenameAvailabiliyInfo> &Scratch);
|
||||
void collectRenameAvailabilityInfo(
|
||||
const ValueDecl *VD, Optional<RenameRefInfo> RefInfo,
|
||||
llvm::SmallVectorImpl<RenameAvailabilityInfo> &Infos);
|
||||
|
||||
} // namespace ide
|
||||
} // namespace swift
|
||||
|
||||
Reference in New Issue
Block a user