Skip to content

Commit 6da428a

Browse files
committed
[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.
1 parent cff4ddf commit 6da428a

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ class ImportDecl final : public Decl,
15141514
return getImportPath().getModulePath(getImportKind());
15151515
}
15161516

1517-
ImportPath::Access getDeclPath() const {
1517+
ImportPath::Access getAccessPath() const {
15181518
return getImportPath().getAccessPath(getImportKind());
15191519
}
15201520

include/swift/AST/Import.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class ImportPath : public detail::ImportPathBase<ImportPath> {
229229
///
230230
/// \c ImportPath::Access is essentially a wrapper around \c ArrayRef and does
231231
/// not own its elements, so something else needs to manage their lifetime.
232-
/// \c ImportDecl owns the memory backing \c ImportDecl::getDeclPath().
232+
/// \c ImportDecl owns the memory backing \c ImportDecl::getAccessPath().
233233
class Access : public detail::ImportPathBase<Access> {
234234
public:
235235
/// A helper type which encapsulates a temporary vector and can produce a

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2089,7 +2089,7 @@ void IRGenDebugInfoImpl::emitImport(ImportDecl *D) {
20892089
return;
20902090

20912091
assert(D->getModule() && "compiler-synthesized ImportDecl is incomplete");
2092-
ModuleDecl::ImportedModule Imported = { D->getDeclPath(), D->getModule() };
2092+
ModuleDecl::ImportedModule Imported = { D->getAccessPath(), D->getModule() };
20932093
auto DIMod = getOrCreateModule(Imported);
20942094
auto L = getDebugLoc(*this, D);
20952095
auto *File = getOrCreateFile(L.Filename);

lib/Sema/ImportResolution.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ struct UnboundImport {
7575
/// If this is a scoped import, the names of the declaration being imported;
7676
/// otherwise empty. (Currently the compiler doesn't support nested scoped
7777
/// imports, so there should always be zero or one elements, but
78-
/// \c AccessPathTy is the common currency type for this.)
79-
ImportPath::Access declPath;
78+
/// \c ImportPath::Access is the common currency type for this.)
79+
ImportPath::Access accessPath;
8080

8181
// Names of explicitly imported SPI groups via @_spi.
8282
ArrayRef<Identifier> spiGroups;
@@ -141,7 +141,7 @@ struct UnboundImport {
141141
/// Create an \c ImportedModuleDesc from the information in this
142142
/// UnboundImport.
143143
ImportedModuleDesc makeDesc(ModuleDecl *module) const {
144-
return ImportedModuleDesc({ declPath, module }, options,
144+
return ImportedModuleDesc({ accessPath, module }, options,
145145
privateImportFileName, spiGroups);
146146
}
147147

@@ -501,7 +501,7 @@ ModuleImplicitImportsRequest::evaluate(Evaluator &evaluator,
501501
/// Create an UnboundImport for a user-written import declaration.
502502
UnboundImport::UnboundImport(ImportDecl *ID)
503503
: importLoc(ID->getLoc()), options(), privateImportFileName(),
504-
modulePath(ID->getModulePath()), declPath(ID->getDeclPath()),
504+
modulePath(ID->getModulePath()), accessPath(ID->getAccessPath()),
505505
importOrUnderlyingModuleDecl(ID)
506506
{
507507
if (ID->isExported())
@@ -850,34 +850,34 @@ ScopedImportLookupRequest::evaluate(Evaluator &evaluator,
850850
/// we've performed import resolution, since that can introduce additional
851851
/// imports (such as cross-import overlays) which could provide the declaration.
852852
auto &ctx = module->getASTContext();
853-
auto declPath = import->getDeclPath();
853+
auto accessPath = import->getAccessPath();
854854
auto modulePath = import->getModulePath();
855855
auto *topLevelModule = module->getTopLevelModule();
856856

857857
// Lookup the referenced decl in the top-level module. This is necessary as
858858
// the Clang importer currently handles submodules by importing their decls
859859
// into the top-level module.
860860
// FIXME: Doesn't handle scoped testable imports correctly.
861-
assert(declPath.size() == 1 && "can't handle sub-decl imports");
861+
assert(accessPath.size() == 1 && "can't handle sub-decl imports");
862862
SmallVector<ValueDecl *, 8> decls;
863-
lookupInModule(topLevelModule, declPath.front().Item, decls,
863+
lookupInModule(topLevelModule, accessPath.front().Item, decls,
864864
NLKind::QualifiedLookup, ResolutionKind::Overloadable,
865865
import->getDeclContext()->getModuleScopeContext());
866866

867867
auto importLoc = import->getLoc();
868868
if (decls.empty()) {
869869
ctx.Diags.diagnose(importLoc, diag::decl_does_not_exist_in_module,
870870
static_cast<unsigned>(importKind),
871-
declPath.front().Item, modulePath.front().Item)
872-
.highlight(declPath.getSourceRange());
871+
accessPath.front().Item, modulePath.front().Item)
872+
.highlight(accessPath.getSourceRange());
873873
return ArrayRef<ValueDecl *>();
874874
}
875875

876876
Optional<ImportKind> actualKind = ImportDecl::findBestImportKind(decls);
877877
if (!actualKind.hasValue()) {
878878
// FIXME: print entire module name?
879879
ctx.Diags.diagnose(importLoc, diag::ambiguous_decl_in_module,
880-
declPath.front().Item, module->getName());
880+
accessPath.front().Item, module->getName());
881881
for (auto next : decls)
882882
ctx.Diags.diagnose(next, diag::found_candidate);
883883

@@ -899,7 +899,7 @@ ScopedImportLookupRequest::evaluate(Evaluator &evaluator,
899899
} else {
900900
emittedDiag.emplace(ctx.Diags.diagnose(
901901
importLoc, diag::imported_decl_is_wrong_kind,
902-
declPath.front().Item, getImportKindString(importKind),
902+
accessPath.front().Item, getImportKindString(importKind),
903903
static_cast<unsigned>(*actualKind)));
904904
}
905905

@@ -940,7 +940,7 @@ UnboundImport::UnboundImport(ASTContext &ctx, const UnboundImport &base,
940940
.copyTo(ctx)),
941941
// If the declaring import was scoped, inherit that scope in the
942942
// overlay's import.
943-
declPath(declaringImport.module.accessPath),
943+
accessPath(declaringImport.module.accessPath),
944944
importOrUnderlyingModuleDecl(declaringImport.module.importedModule)
945945
{
946946
// A cross-import is never private or testable, and never comes from a private

0 commit comments

Comments
 (0)