mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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:
@@ -202,15 +202,13 @@ static void adjustPrintOptions(PrintOptions &AdjustedOptions) {
|
||||
AdjustedOptions.VarInitializers = false;
|
||||
}
|
||||
|
||||
ArrayRef<StringRef>
|
||||
swift::ide::collectModuleGroups(ModuleDecl *M, std::vector<StringRef> &Scratch) {
|
||||
void swift::ide::collectModuleGroups(ModuleDecl *M,
|
||||
SmallVectorImpl<StringRef> &Into) {
|
||||
for (auto File : M->getFiles()) {
|
||||
File->collectAllGroups(Scratch);
|
||||
File->collectAllGroups(Into);
|
||||
}
|
||||
std::sort(Scratch.begin(), Scratch.end(), [](StringRef L, StringRef R) {
|
||||
return L.compare_lower(R) < 0;
|
||||
});
|
||||
return llvm::makeArrayRef(Scratch);
|
||||
std::sort(Into.begin(), Into.end(),
|
||||
[](StringRef L, StringRef R) { return L.compare_lower(R) < 0; });
|
||||
}
|
||||
|
||||
/// Determine whether the given extension has a Clang node that
|
||||
|
||||
Reference in New Issue
Block a user