mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #63906 from bnbarham/add-nested-expansion
[Refactor] Allow expanding nested macros
This commit is contained in:
@@ -730,27 +730,12 @@ RenameRangeCollector::indexSymbolToRenameLoc(const index::IndexSymbol &symbol,
|
||||
isFunctionLike, isNonProtocolType};
|
||||
}
|
||||
|
||||
ArrayRef<SourceFile*>
|
||||
collectSourceFiles(ModuleDecl *MD, SmallVectorImpl<SourceFile *> &Scratch) {
|
||||
for (auto Unit : MD->getFiles()) {
|
||||
if (auto SF = dyn_cast<SourceFile>(Unit)) {
|
||||
Scratch.push_back(SF);
|
||||
}
|
||||
}
|
||||
return llvm::makeArrayRef(Scratch);
|
||||
}
|
||||
|
||||
/// Get the source file that contains the given range and belongs to the module.
|
||||
/// Get the source file that corresponds to the given buffer.
|
||||
SourceFile *getContainingFile(ModuleDecl *M, RangeConfig Range) {
|
||||
SmallVector<SourceFile*, 4> Files;
|
||||
for (auto File : collectSourceFiles(M, Files)) {
|
||||
if (File->getBufferID()) {
|
||||
if (File->getBufferID().value() == Range.BufferId) {
|
||||
return File;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
auto &SM = M->getASTContext().SourceMgr;
|
||||
// TODO: We should add an ID -> SourceFile mapping.
|
||||
return M->getSourceFileContainingLocation(
|
||||
SM.getRangeForBuffer(Range.BufferID).getStart());
|
||||
}
|
||||
|
||||
class RefactoringAction {
|
||||
@@ -8804,7 +8789,7 @@ getDescriptiveRefactoringKindName(RefactoringKind Kind) {
|
||||
}
|
||||
|
||||
SourceLoc swift::ide::RangeConfig::getStart(SourceManager &SM) {
|
||||
return SM.getLocForLineCol(BufferId, Line, Column);
|
||||
return SM.getLocForLineCol(BufferID, Line, Column);
|
||||
}
|
||||
|
||||
SourceLoc swift::ide::RangeConfig::getEnd(SourceManager &SM) {
|
||||
|
||||
Reference in New Issue
Block a user