Remove IDEInspectionFileRequest

We now maintain a mapping of buffer IDs to SourceFiles on the
SourceManager we can use.
This commit is contained in:
Hamish Knight
2025-03-20 12:53:10 +00:00
parent a8111e4786
commit 2d7dbd3965
4 changed files with 9 additions and 37 deletions

View File

@@ -912,20 +912,6 @@ ArrayRef<SourceFile *> ModuleDecl::getPrimarySourceFiles() const {
return evaluateOrDefault(eval, PrimarySourceFilesRequest{mutableThis}, {});
}
SourceFile *IDEInspectionFileRequest::evaluate(Evaluator &evaluator,
ModuleDecl *mod) const {
const auto &SM = mod->getASTContext().SourceMgr;
assert(mod->isMainModule() && "Can only do completion in the main module");
assert(SM.hasIDEInspectionTargetBuffer() && "Not in IDE inspection mode?");
for (auto *file : mod->getFiles()) {
auto *SF = dyn_cast<SourceFile>(file);
if (SF && SF->getBufferID() == SM.getIDEInspectionTargetBufferID())
return SF;
}
llvm_unreachable("Couldn't find the completion file?");
}
#define FORWARD(name, args) \
for (const FileUnit *file : getFiles()) { \
file->name args; \