Skip to content

Commit a341c86

Browse files
committed
[AST] NFC: Rename VarDecl::visitAuxiliaryDecls -> visitAuxiliaryVars
Make it more obvious it's different to `Decl::visitAuxiliaryDecls`.
1 parent 17a8706 commit a341c86

File tree

8 files changed

+19
-20
lines changed

8 files changed

+19
-20
lines changed

include/swift/AST/Decl.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6725,13 +6725,14 @@ class VarDecl : public AbstractStorageDecl {
67256725
Bits.VarDecl.IsDebuggerVar = IsDebuggerVar;
67266726
}
67276727

6728-
/// Visit all auxiliary declarations to this VarDecl.
6728+
/// Visit all auxiliary variables for this VarDecl.
67296729
///
6730-
/// An auxiliary declaration is a declaration synthesized by the compiler to support
6731-
/// this VarDecl, such as synthesized property wrapper variables.
6730+
/// An auxiliary variable is one that is synthesized by the compiler to
6731+
/// support this VarDecl, such as synthesized property wrapper variables.
67326732
///
6733-
/// \note this function only visits auxiliary decls that are not part of the AST.
6734-
void visitAuxiliaryDecls(llvm::function_ref<void(VarDecl *)>) const;
6733+
/// \note this function only visits auxiliary variables that are not part of
6734+
/// the AST.
6735+
void visitAuxiliaryVars(llvm::function_ref<void(VarDecl *)>) const;
67356736

67366737
/// Is this the synthesized storage for a 'lazy' property?
67376738
bool isLazyStorageProperty() const {

lib/AST/Decl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ void Decl::visitAuxiliaryDecls(
507507
}
508508
}
509509

510-
// FIXME: fold VarDecl::visitAuxiliaryDecls into this.
510+
// FIXME: fold VarDecl::visitAuxiliaryVars into this.
511511
}
512512

513513
void Decl::forEachAttachedMacro(MacroRole role,
@@ -8767,7 +8767,8 @@ bool VarDecl::hasStorageOrWrapsStorage() const {
87678767
return false;
87688768
}
87698769

8770-
void VarDecl::visitAuxiliaryDecls(llvm::function_ref<void(VarDecl *)> visit) const {
8770+
void VarDecl::visitAuxiliaryVars(
8771+
llvm::function_ref<void(VarDecl *)> visit) const {
87718772
if (getDeclContext()->isTypeContext() ||
87728773
(isImplicit() && !isa<ParamDecl>(this)))
87738774
return;

lib/AST/UnqualifiedLookup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ bool ASTScopeDeclConsumerForUnqualifiedLookup::consume(
708708
bool foundMatch = false;
709709
if (auto *varDecl = dyn_cast<VarDecl>(value)) {
710710
// Check if the name matches any auxiliary decls not in the AST
711-
varDecl->visitAuxiliaryDecls([&](VarDecl *auxiliaryVar) {
711+
varDecl->visitAuxiliaryVars([&](VarDecl *auxiliaryVar) {
712712
if (auxiliaryVar->ValueDecl::getName().matchesRef(fullName)) {
713713
value = auxiliaryVar;
714714
foundMatch = true;
@@ -918,7 +918,7 @@ class ASTScopeDeclConsumerForLocalLookup
918918
bool foundMatch = false;
919919
if (auto *varDecl = dyn_cast<VarDecl>(value)) {
920920
// Check if the name matches any auxiliary decls not in the AST
921-
varDecl->visitAuxiliaryDecls([&](VarDecl *auxiliaryVar) {
921+
varDecl->visitAuxiliaryVars([&](VarDecl *auxiliaryVar) {
922922
if (name.isSimpleName(auxiliaryVar->getName())
923923
&& hasCorrectABIRole(auxiliaryVar)) {
924924
results.push_back(auxiliaryVar);

lib/SILGen/SILGenDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ void SILGenFunction::visitVarDecl(VarDecl *D) {
17161716
}
17171717

17181718
// Emit lazy and property wrapper backing storage.
1719-
D->visitAuxiliaryDecls([&](VarDecl *var) {
1719+
D->visitAuxiliaryVars([&](VarDecl *var) {
17201720
if (auto *patternBinding = var->getParentPatternBinding())
17211721
visitPatternBindingDecl(patternBinding);
17221722

lib/SILGen/SILGenProlog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ class ArgumentInitHelper {
10641064
void emitParam(ParamDecl *PD) {
10651065
// Register any auxiliary declarations for the parameter to be
10661066
// visited later.
1067-
PD->visitAuxiliaryDecls([&](VarDecl *localVar) {
1067+
PD->visitAuxiliaryVars([&](VarDecl *localVar) {
10681068
SGF.LocalAuxiliaryDecls.push_back(localVar);
10691069
});
10701070

lib/Sema/LookupVisibleDecls.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,8 +1224,7 @@ class ASTScopeVisibleDeclConsumer
12241224
// auxiliary variables (unless 'var' is a closure param).
12251225
(void)var->getPropertyWrapperBackingPropertyType();
12261226
}
1227-
var->visitAuxiliaryDecls(
1228-
[&](VarDecl *auxVar) { foundDecl(auxVar); });
1227+
var->visitAuxiliaryVars([&](VarDecl *auxVar) { foundDecl(auxVar); });
12291228
}
12301229
// NOTE: We don't call Decl::visitAuxiliaryDecls here since peer decls of
12311230
// local decls should not show up in lookup results.

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,9 +2382,8 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
23822382
checkGlobalIsolation(VD);
23832383

23842384
// Visit auxiliary decls first
2385-
VD->visitAuxiliaryDecls([&](VarDecl *var) {
2386-
this->visitBoundVariable(var);
2387-
});
2385+
VD->visitAuxiliaryVars(
2386+
[&](VarDecl *var) { this->visitBoundVariable(var); });
23882387

23892388
// Reject cases where this is a variable that has storage but it isn't
23902389
// allowed.
@@ -4119,7 +4118,7 @@ void TypeChecker::checkParameterList(ParameterList *params,
41194118

41204119
if (!param->isInvalid()) {
41214120
auto *SF = owner->getParentSourceFile();
4122-
param->visitAuxiliaryDecls([&](VarDecl *auxiliaryDecl) {
4121+
param->visitAuxiliaryVars([&](VarDecl *auxiliaryDecl) {
41234122
if (!isa<ParamDecl>(auxiliaryDecl))
41244123
DeclChecker(SF->getASTContext(), SF).visitBoundVariable(auxiliaryDecl);
41254124
});

lib/Sema/TypeCheckStmt.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ namespace {
153153

154154
// Auxiliary decls need to have their contexts adjusted too.
155155
if (auto *VD = dyn_cast<VarDecl>(D)) {
156-
VD->visitAuxiliaryDecls([&](VarDecl *D) {
157-
D->setDeclContext(ParentDC);
158-
});
156+
VD->visitAuxiliaryVars(
157+
[&](VarDecl *D) { D->setDeclContext(ParentDC); });
159158
}
160159

161160
// We don't currently support peer macro declarations in local contexts,

0 commit comments

Comments
 (0)