[NFC] Add ASTContext::getModuleByIdentifier()

This is a reasonably common operation.
This commit is contained in:
Brent Royal-Gordon
2020-08-31 12:55:06 -07:00
parent 7bfeeebcb9
commit cce0411000
9 changed files with 17 additions and 24 deletions

View File

@@ -447,8 +447,7 @@ ModuleImplicitImportsRequest::evaluate(Evaluator &evaluator,
// Add any modules we were asked to implicitly import.
for (auto moduleName : importInfo.ModuleNames) {
auto *importModule = ctx.getModule(
ImportPath::Module::Builder(moduleName).get());
auto *importModule = ctx.getModuleByIdentifier(moduleName);
if (!importModule) {
ctx.Diags.diagnose(SourceLoc(), diag::sema_no_import, moduleName.str());
if (ctx.SearchPathOpts.SDKPath.empty() &&