Skip to content

Commit aaebc5f

Browse files
committed
[ASTDump] NFC: Use const auto in cxx_range_for loops
This is coming up a lot in reviews. Better just to do them all at once. llvm-svn: 351646
1 parent 6515db2 commit aaebc5f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

clang/lib/AST/ASTDumper.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ namespace {
161161
}
162162
void VisitFunctionProtoType(const FunctionProtoType *T) {
163163
VisitFunctionType(T);
164-
for (QualType PT : T->getParamTypes())
164+
for (const QualType &PT : T->getParamTypes())
165165
dumpTypeAsChild(PT);
166166
}
167167
void VisitTypeOfExprType(const TypeOfExprType *T) {
@@ -186,7 +186,7 @@ namespace {
186186
dumpTemplateArgument(T->getArgumentPack());
187187
}
188188
void VisitTemplateSpecializationType(const TemplateSpecializationType *T) {
189-
for (auto &Arg : *T)
189+
for (const auto &Arg : *T)
190190
dumpTemplateArgument(Arg);
191191
if (T->isTypeAlias())
192192
dumpTypeAsChild(T->getAliasedType());
@@ -357,7 +357,7 @@ void ASTDumper::dumpDeclContext(const DeclContext *DC) {
357357
if (!DC)
358358
return;
359359

360-
for (auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
360+
for (const auto *D : (Deserialize ? DC->decls() : DC->noload_decls()))
361361
dumpDecl(D);
362362
}
363363

@@ -478,7 +478,7 @@ void ASTDumper::dumpObjCTypeParamList(const ObjCTypeParamList *typeParams) {
478478
if (!typeParams)
479479
return;
480480

481-
for (auto typeParam : *typeParams) {
481+
for (const auto &typeParam : *typeParams) {
482482
dumpDecl(typeParam);
483483
}
484484
}
@@ -555,7 +555,7 @@ void ASTDumper::VisitIndirectFieldDecl(const IndirectFieldDecl *D) {
555555
NodeDumper.dumpName(D);
556556
NodeDumper.dumpType(D->getType());
557557

558-
for (auto *Child : D->chain())
558+
for (const auto *Child : D->chain())
559559
NodeDumper.dumpDeclRef(Child);
560560
}
561561

@@ -688,14 +688,14 @@ void ASTDumper::VisitVarDecl(const VarDecl *D) {
688688

689689
void ASTDumper::VisitDecompositionDecl(const DecompositionDecl *D) {
690690
VisitVarDecl(D);
691-
for (auto *B : D->bindings())
691+
for (const auto *B : D->bindings())
692692
dumpDecl(B);
693693
}
694694

695695
void ASTDumper::VisitBindingDecl(const BindingDecl *D) {
696696
NodeDumper.dumpName(D);
697697
NodeDumper.dumpType(D->getType());
698-
if (auto *E = D->getBinding())
698+
if (const auto *E = D->getBinding())
699699
dumpStmt(E);
700700
}
701701

@@ -736,7 +736,7 @@ void ASTDumper::VisitCapturedDecl(const CapturedDecl *D) {
736736
//===----------------------------------------------------------------------===//
737737

738738
void ASTDumper::VisitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D) {
739-
for (auto *E : D->varlists())
739+
for (const auto *E : D->varlists())
740740
dumpStmt(E);
741741
}
742742

@@ -766,7 +766,7 @@ void ASTDumper::VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D) {
766766
}
767767

768768
void ASTDumper::VisitOMPRequiresDecl(const OMPRequiresDecl *D) {
769-
for (auto *C : D->clauselists()) {
769+
for (const auto *C : D->clauselists()) {
770770
dumpChild([=] {
771771
if (!C) {
772772
ColorScope Color(OS, ShowColors, NullColor);
@@ -974,7 +974,7 @@ void ASTDumper::dumpTemplateDeclSpecialization(const SpecializationDecl *D,
974974
bool DumpExplicitInst,
975975
bool DumpRefOnly) {
976976
bool DumpedAny = false;
977-
for (auto *RedeclWithBadType : D->redecls()) {
977+
for (const auto *RedeclWithBadType : D->redecls()) {
978978
// FIXME: The redecls() range sometimes has elements of a less-specific
979979
// type. (In particular, ClassTemplateSpecializationDecl::redecls() gives
980980
// us TagDecls, and should give CXXRecordDecls).
@@ -1018,7 +1018,7 @@ void ASTDumper::dumpTemplateDecl(const TemplateDecl *D, bool DumpExplicitInst) {
10181018

10191019
dumpDecl(D->getTemplatedDecl());
10201020

1021-
for (auto *Child : D->specializations())
1021+
for (const auto *Child : D->specializations())
10221022
dumpTemplateDeclSpecialization(Child, DumpExplicitInst,
10231023
!D->isCanonicalDecl());
10241024
}
@@ -1280,7 +1280,7 @@ void ASTDumper::VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D) {
12801280
void ASTDumper::VisitObjCProtocolDecl(const ObjCProtocolDecl *D) {
12811281
NodeDumper.dumpName(D);
12821282

1283-
for (auto *Child : D->protocols())
1283+
for (const auto *Child : D->protocols())
12841284
NodeDumper.dumpDeclRef(Child);
12851285
}
12861286

@@ -1289,7 +1289,7 @@ void ASTDumper::VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D) {
12891289
NodeDumper.dumpDeclRef(D->getSuperClass(), "super");
12901290

12911291
NodeDumper.dumpDeclRef(D->getImplementation());
1292-
for (auto *Child : D->protocols())
1292+
for (const auto *Child : D->protocols())
12931293
NodeDumper.dumpDeclRef(Child);
12941294
dumpObjCTypeParamList(D->getTypeParamListAsWritten());
12951295
}
@@ -1374,7 +1374,7 @@ void ASTDumper::VisitBlockDecl(const BlockDecl *D) {
13741374
if (D->capturesCXXThis())
13751375
OS << " captures_this";
13761376

1377-
for (auto I : D->parameters())
1377+
for (const auto &I : D->parameters())
13781378
dumpDecl(I);
13791379

13801380
for (const auto &I : D->captures())
@@ -1435,7 +1435,7 @@ void ASTDumper::VisitCapturedStmt(const CapturedStmt *Node) {
14351435
void ASTDumper::Visit(const OMPClause *C) {
14361436
dumpChild([=] {
14371437
NodeDumper.Visit(C);
1438-
for (auto *S : C->children())
1438+
for (const auto *S : C->children())
14391439
dumpStmt(S);
14401440
});
14411441
}

0 commit comments

Comments
 (0)