Skip to content

Commit f185dd6

Browse files
committed
[QoI] Fix -Wrange-loop-analysis warnings
1 parent 456ecaf commit f185dd6

File tree

10 files changed

+14
-14
lines changed

10 files changed

+14
-14
lines changed

lib/AST/FineGrainedDependenciesSourceFileDepGraphConstructor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,11 @@ class SourceFileDepGraphConstructor {
577577

578578
SourceFileDeclFinder declFinder(SF, includePrivateDeps);
579579
std::vector<std::pair<std::string, bool>> topLevelDepends;
580-
for (const auto p: SF->getReferencedNameTracker()->getTopLevelNames())
580+
for (const auto &p: SF->getReferencedNameTracker()->getTopLevelNames())
581581
topLevelDepends.push_back(std::make_pair(p.getFirst().userFacingName(), p.getSecond()));
582582

583583
std::vector<std::pair<std::string, bool>> dynamicLookupDepends;
584-
for (const auto p: SF->getReferencedNameTracker()->getDynamicLookupNames())
584+
for (const auto &p: SF->getReferencedNameTracker()->getDynamicLookupNames())
585585
dynamicLookupDepends.push_back(std::make_pair(p.getFirst().userFacingName(), p.getSecond()));
586586

587587
std::vector<std::pair<std::tuple<std::string, std::string, bool>, bool>> memberDepends;
@@ -652,7 +652,7 @@ class SourceFileDepGraphConstructor {
652652
static std::vector<ContextNameFingerprint>
653653
namesForProvidersOfAGivenType(std::vector<ContentsT> &contentsVec) {
654654
std::vector<ContextNameFingerprint> result;
655-
for (const auto declOrPair : contentsVec)
655+
for (const auto &declOrPair : contentsVec)
656656
result.push_back(ContextNameFingerprint(
657657
DependencyKey::computeContextForProvidedEntity<kind>(declOrPair),
658658
DependencyKey::computeNameForProvidedEntity<kind>(declOrPair),

lib/Driver/FineGrainedDependencyDriverGraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ void ModuleDepGraph::verifyExternalDependencyUniqueness(
543543
void ModuleDepGraph::verifyCanFindEachJob() const {
544544
FrontendStatsTracer tracer(stats,
545545
"fine-grained-dependencies-verifyCanFindEachJob");
546-
for (const auto p : jobsBySwiftDeps) {
546+
for (const auto &p : jobsBySwiftDeps) {
547547
getJob(p.first);
548548
}
549549
}

lib/Driver/ParseableOutput.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class DetailedCommandBasedMessage : public CommandBasedMessage {
125125
if (const auto *BJAction = dyn_cast<BackendJobAction>(&Cmd.getSource())) {
126126
Inputs.push_back(CommandInput(OutFiles[BJAction->getInputIndex()]));
127127
} else {
128-
for (const std::string &FileName : OutFiles) {
128+
for (const std::string FileName : OutFiles) {
129129
Inputs.push_back(CommandInput(FileName));
130130
}
131131
}
@@ -134,7 +134,7 @@ class DetailedCommandBasedMessage : public CommandBasedMessage {
134134
// TODO: set up Outputs appropriately.
135135
file_types::ID PrimaryOutputType = Cmd.getOutput().getPrimaryOutputType();
136136
if (PrimaryOutputType != file_types::TY_Nothing) {
137-
for (const std::string &OutputFileName : Cmd.getOutput().
137+
for (const std::string OutputFileName : Cmd.getOutput().
138138
getPrimaryOutputFilenames()) {
139139
Outputs.push_back(OutputPair(PrimaryOutputType, OutputFileName));
140140
}

lib/IRGen/GenProto.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2717,7 +2717,7 @@ void NecessaryBindings::addTypeMetadata(CanType type) {
27172717
return;
27182718
}
27192719
if (auto fn = dyn_cast<FunctionType>(type)) {
2720-
for (const auto &elt : fn.getParams())
2720+
for (const auto elt : fn.getParams())
27212721
addTypeMetadata(elt.getPlainType());
27222722
addTypeMetadata(fn.getResult());
27232723
return;

lib/IRGen/MetadataPath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class MetadataPath {
183183
/// Return an abstract measurement of the cost of this path.
184184
OperationCost cost() const {
185185
auto cost = OperationCost::Free;
186-
for (const Component &component : Path)
186+
for (const Component component : Path)
187187
cost += component.cost();
188188
return cost;
189189
}

lib/SILOptimizer/Mandatory/MandatoryInlining.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ getCalleeFunction(SILFunction *F, FullApplySite AI, bool &IsThick,
598598
FullArgs.clear();
599599

600600
// First grab our basic arguments from our apply.
601-
for (const auto &Arg : AI.getArguments())
601+
for (const auto Arg : AI.getArguments())
602602
FullArgs.push_back(Arg);
603603

604604
// Then grab a first approximation of our apply by stripping off all copy

lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,9 +1284,9 @@ SILInstruction *SILCombiner::visitCondBranchInst(CondBranchInst *CBI) {
12841284
X->getType() ==
12851285
SILType::getBuiltinIntegerType(1, CBI->getModule().getASTContext())) {
12861286
SmallVector<SILValue, 4> OrigTrueArgs, OrigFalseArgs;
1287-
for (const auto &Op : CBI->getTrueArgs())
1287+
for (const auto Op : CBI->getTrueArgs())
12881288
OrigTrueArgs.push_back(Op);
1289-
for (const auto &Op : CBI->getFalseArgs())
1289+
for (const auto Op : CBI->getFalseArgs())
12901290
OrigFalseArgs.push_back(Op);
12911291
return Builder.createCondBranch(CBI->getLoc(), X,
12921292
CBI->getFalseBB(), OrigFalseArgs,

lib/SILOptimizer/UtilityPasses/SerializeSILPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static bool hasOpaqueArchetypeOperand(TypeExpansionContext context,
131131
static bool hasOpaqueArchetypeResult(TypeExpansionContext context,
132132
SILInstruction &inst) {
133133
// Check the results for opaque types.
134-
for (const auto &res : inst.getResults())
134+
for (const auto res : inst.getResults())
135135
if (opaqueArchetypeWouldChange(context, res->getType().getASTType()))
136136
return true;
137137
return false;

lib/SILOptimizer/Utils/SILInliner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ SILInliner::inlineFullApply(FullApplySite apply,
350350
SILOptFunctionBuilder &funcBuilder) {
351351
assert(apply.canOptimize());
352352
SmallVector<SILValue, 8> appliedArgs;
353-
for (const auto &arg : apply.getArguments())
353+
for (const auto arg : apply.getArguments())
354354
appliedArgs.push_back(arg);
355355

356356
SILFunction *caller = apply.getFunction();

stdlib/public/Reflection/TypeRefBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ void ClosureContextInfo::dump(FILE *file) const {
447447

448448
void TypeRefBuilder::dumpCaptureSection(FILE *file) {
449449
for (const auto &sections : ReflectionInfos) {
450-
for (const auto &descriptor : sections.Capture) {
450+
for (const auto descriptor : sections.Capture) {
451451
auto info = getClosureContextInfo(descriptor);
452452
info.dump(file);
453453
}

0 commit comments

Comments
 (0)