mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[NFC] Rename “DeclPath” -> “AccessPath”
To avoid ambiguity, ImportResolution and a few other things used the term “decl path” instead of “access path”. Switch back to the correct terminology now that the compiler is becoming more consistent about it.
This commit is contained in:
@@ -1514,7 +1514,7 @@ public:
|
|||||||
return getImportPath().getModulePath(getImportKind());
|
return getImportPath().getModulePath(getImportKind());
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportPath::Access getDeclPath() const {
|
ImportPath::Access getAccessPath() const {
|
||||||
return getImportPath().getAccessPath(getImportKind());
|
return getImportPath().getAccessPath(getImportKind());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// \c ImportPath::Access is essentially a wrapper around \c ArrayRef and does
|
/// \c ImportPath::Access is essentially a wrapper around \c ArrayRef and does
|
||||||
/// not own its elements, so something else needs to manage their lifetime.
|
/// not own its elements, so something else needs to manage their lifetime.
|
||||||
/// \c ImportDecl owns the memory backing \c ImportDecl::getDeclPath().
|
/// \c ImportDecl owns the memory backing \c ImportDecl::getAccessPath().
|
||||||
class Access : public detail::ImportPathBase<Access> {
|
class Access : public detail::ImportPathBase<Access> {
|
||||||
public:
|
public:
|
||||||
/// A helper type which encapsulates a temporary vector and can produce a
|
/// A helper type which encapsulates a temporary vector and can produce a
|
||||||
|
|||||||
@@ -2089,7 +2089,7 @@ void IRGenDebugInfoImpl::emitImport(ImportDecl *D) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
assert(D->getModule() && "compiler-synthesized ImportDecl is incomplete");
|
assert(D->getModule() && "compiler-synthesized ImportDecl is incomplete");
|
||||||
ModuleDecl::ImportedModule Imported = { D->getDeclPath(), D->getModule() };
|
ModuleDecl::ImportedModule Imported = { D->getAccessPath(), D->getModule() };
|
||||||
auto DIMod = getOrCreateModule(Imported);
|
auto DIMod = getOrCreateModule(Imported);
|
||||||
auto L = getDebugLoc(*this, D);
|
auto L = getDebugLoc(*this, D);
|
||||||
auto *File = getOrCreateFile(L.Filename);
|
auto *File = getOrCreateFile(L.Filename);
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ struct UnboundImport {
|
|||||||
/// If this is a scoped import, the names of the declaration being imported;
|
/// If this is a scoped import, the names of the declaration being imported;
|
||||||
/// otherwise empty. (Currently the compiler doesn't support nested scoped
|
/// otherwise empty. (Currently the compiler doesn't support nested scoped
|
||||||
/// imports, so there should always be zero or one elements, but
|
/// imports, so there should always be zero or one elements, but
|
||||||
/// \c AccessPathTy is the common currency type for this.)
|
/// \c ImportPath::Access is the common currency type for this.)
|
||||||
ImportPath::Access declPath;
|
ImportPath::Access accessPath;
|
||||||
|
|
||||||
// Names of explicitly imported SPI groups via @_spi.
|
// Names of explicitly imported SPI groups via @_spi.
|
||||||
ArrayRef<Identifier> spiGroups;
|
ArrayRef<Identifier> spiGroups;
|
||||||
@@ -141,7 +141,7 @@ struct UnboundImport {
|
|||||||
/// Create an \c ImportedModuleDesc from the information in this
|
/// Create an \c ImportedModuleDesc from the information in this
|
||||||
/// UnboundImport.
|
/// UnboundImport.
|
||||||
ImportedModuleDesc makeDesc(ModuleDecl *module) const {
|
ImportedModuleDesc makeDesc(ModuleDecl *module) const {
|
||||||
return ImportedModuleDesc({ declPath, module }, options,
|
return ImportedModuleDesc({ accessPath, module }, options,
|
||||||
privateImportFileName, spiGroups);
|
privateImportFileName, spiGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,7 +501,7 @@ ModuleImplicitImportsRequest::evaluate(Evaluator &evaluator,
|
|||||||
/// Create an UnboundImport for a user-written import declaration.
|
/// Create an UnboundImport for a user-written import declaration.
|
||||||
UnboundImport::UnboundImport(ImportDecl *ID)
|
UnboundImport::UnboundImport(ImportDecl *ID)
|
||||||
: importLoc(ID->getLoc()), options(), privateImportFileName(),
|
: importLoc(ID->getLoc()), options(), privateImportFileName(),
|
||||||
modulePath(ID->getModulePath()), declPath(ID->getDeclPath()),
|
modulePath(ID->getModulePath()), accessPath(ID->getAccessPath()),
|
||||||
importOrUnderlyingModuleDecl(ID)
|
importOrUnderlyingModuleDecl(ID)
|
||||||
{
|
{
|
||||||
if (ID->isExported())
|
if (ID->isExported())
|
||||||
@@ -850,7 +850,7 @@ ScopedImportLookupRequest::evaluate(Evaluator &evaluator,
|
|||||||
/// we've performed import resolution, since that can introduce additional
|
/// we've performed import resolution, since that can introduce additional
|
||||||
/// imports (such as cross-import overlays) which could provide the declaration.
|
/// imports (such as cross-import overlays) which could provide the declaration.
|
||||||
auto &ctx = module->getASTContext();
|
auto &ctx = module->getASTContext();
|
||||||
auto declPath = import->getDeclPath();
|
auto accessPath = import->getAccessPath();
|
||||||
auto modulePath = import->getModulePath();
|
auto modulePath = import->getModulePath();
|
||||||
auto *topLevelModule = module->getTopLevelModule();
|
auto *topLevelModule = module->getTopLevelModule();
|
||||||
|
|
||||||
@@ -858,9 +858,9 @@ ScopedImportLookupRequest::evaluate(Evaluator &evaluator,
|
|||||||
// the Clang importer currently handles submodules by importing their decls
|
// the Clang importer currently handles submodules by importing their decls
|
||||||
// into the top-level module.
|
// into the top-level module.
|
||||||
// FIXME: Doesn't handle scoped testable imports correctly.
|
// FIXME: Doesn't handle scoped testable imports correctly.
|
||||||
assert(declPath.size() == 1 && "can't handle sub-decl imports");
|
assert(accessPath.size() == 1 && "can't handle sub-decl imports");
|
||||||
SmallVector<ValueDecl *, 8> decls;
|
SmallVector<ValueDecl *, 8> decls;
|
||||||
lookupInModule(topLevelModule, declPath.front().Item, decls,
|
lookupInModule(topLevelModule, accessPath.front().Item, decls,
|
||||||
NLKind::QualifiedLookup, ResolutionKind::Overloadable,
|
NLKind::QualifiedLookup, ResolutionKind::Overloadable,
|
||||||
import->getDeclContext()->getModuleScopeContext());
|
import->getDeclContext()->getModuleScopeContext());
|
||||||
|
|
||||||
@@ -868,8 +868,8 @@ ScopedImportLookupRequest::evaluate(Evaluator &evaluator,
|
|||||||
if (decls.empty()) {
|
if (decls.empty()) {
|
||||||
ctx.Diags.diagnose(importLoc, diag::decl_does_not_exist_in_module,
|
ctx.Diags.diagnose(importLoc, diag::decl_does_not_exist_in_module,
|
||||||
static_cast<unsigned>(importKind),
|
static_cast<unsigned>(importKind),
|
||||||
declPath.front().Item, modulePath.front().Item)
|
accessPath.front().Item, modulePath.front().Item)
|
||||||
.highlight(declPath.getSourceRange());
|
.highlight(accessPath.getSourceRange());
|
||||||
return ArrayRef<ValueDecl *>();
|
return ArrayRef<ValueDecl *>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,7 +877,7 @@ ScopedImportLookupRequest::evaluate(Evaluator &evaluator,
|
|||||||
if (!actualKind.hasValue()) {
|
if (!actualKind.hasValue()) {
|
||||||
// FIXME: print entire module name?
|
// FIXME: print entire module name?
|
||||||
ctx.Diags.diagnose(importLoc, diag::ambiguous_decl_in_module,
|
ctx.Diags.diagnose(importLoc, diag::ambiguous_decl_in_module,
|
||||||
declPath.front().Item, module->getName());
|
accessPath.front().Item, module->getName());
|
||||||
for (auto next : decls)
|
for (auto next : decls)
|
||||||
ctx.Diags.diagnose(next, diag::found_candidate);
|
ctx.Diags.diagnose(next, diag::found_candidate);
|
||||||
|
|
||||||
@@ -899,7 +899,7 @@ ScopedImportLookupRequest::evaluate(Evaluator &evaluator,
|
|||||||
} else {
|
} else {
|
||||||
emittedDiag.emplace(ctx.Diags.diagnose(
|
emittedDiag.emplace(ctx.Diags.diagnose(
|
||||||
importLoc, diag::imported_decl_is_wrong_kind,
|
importLoc, diag::imported_decl_is_wrong_kind,
|
||||||
declPath.front().Item, getImportKindString(importKind),
|
accessPath.front().Item, getImportKindString(importKind),
|
||||||
static_cast<unsigned>(*actualKind)));
|
static_cast<unsigned>(*actualKind)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -940,7 +940,7 @@ UnboundImport::UnboundImport(ASTContext &ctx, const UnboundImport &base,
|
|||||||
.copyTo(ctx)),
|
.copyTo(ctx)),
|
||||||
// If the declaring import was scoped, inherit that scope in the
|
// If the declaring import was scoped, inherit that scope in the
|
||||||
// overlay's import.
|
// overlay's import.
|
||||||
declPath(declaringImport.module.accessPath),
|
accessPath(declaringImport.module.accessPath),
|
||||||
importOrUnderlyingModuleDecl(declaringImport.module.importedModule)
|
importOrUnderlyingModuleDecl(declaringImport.module.importedModule)
|
||||||
{
|
{
|
||||||
// A cross-import is never private or testable, and never comes from a private
|
// A cross-import is never private or testable, and never comes from a private
|
||||||
|
|||||||
Reference in New Issue
Block a user