[NFC] Adopt new ImportPath types and terminology

# Conflicts:
#	lib/IDE/CodeCompletion.cpp
This commit is contained in:
Brent Royal-Gordon
2020-09-10 19:05:40 -07:00
parent 1ed3caece6
commit cff4ddf13a
52 changed files with 375 additions and 361 deletions

View File

@@ -2014,35 +2014,31 @@ ModuleDecl *ModuleFile::getModule(ModuleID MID) {
llvm_unreachable("implementation detail only");
}
}
return getModule(getIdentifier(MID),
return getModule(ImportPath::Module::Builder(getIdentifier(MID)).get(),
getContext().LangOpts.AllowDeserializingImplementationOnly);
}
ModuleDecl *ModuleFile::getModule(ArrayRef<Identifier> name,
ModuleDecl *ModuleFile::getModule(ImportPath::Module name,
bool allowLoading) {
if (name.empty() || name.front().empty())
if (name.empty() || name.front().Item.empty())
return getContext().TheBuiltinModule;
// FIXME: duplicated from ImportResolver::getModule
if (name.size() == 1 &&
name.front() == FileContext->getParentModule()->getName()) {
name.front().Item == FileContext->getParentModule()->getName()) {
if (!UnderlyingModule && allowLoading) {
auto importer = getContext().getClangModuleLoader();
assert(importer && "no way to import shadowed module");
UnderlyingModule = importer->loadModule(SourceLoc(),
{{name.front(), SourceLoc()}});
UnderlyingModule =
importer->loadModule(SourceLoc(), name.getTopLevelPath());
}
return UnderlyingModule;
}
SmallVector<ImportDecl::AccessPathElement, 4> importPath;
for (auto pathElem : name)
importPath.push_back({ pathElem, SourceLoc() });
if (allowLoading)
return getContext().getModule(importPath);
return getContext().getLoadedModule(importPath);
return getContext().getModule(name);
return getContext().getLoadedModule(name);
}