[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

@@ -214,8 +214,7 @@ static void indexModule(llvm::MemoryBuffer *Input,
std::unique_ptr<ImplicitSerializedModuleLoader> Loader;
ModuleDecl *Mod = nullptr;
if (ModuleName == Ctx.StdlibModuleName.str()) {
Mod = Ctx.getModule(ImportPath::Module::Builder(Ctx.StdlibModuleName)
.get());
Mod = Ctx.getModuleByIdentifier(Ctx.StdlibModuleName);
} else {
Loader = ImplicitSerializedModuleLoader::create(Ctx);
auto Buf = std::unique_ptr<llvm::MemoryBuffer>(