Skip to content

Commit 63afeb1

Browse files
authored
Merge pull request swiftlang#29312 from davezarzycki/pr29312
Fix miscellaneous warnings generated by top-of-tree clang
2 parents 44d937d + 32c66c3 commit 63afeb1

13 files changed

+39
-40
lines changed

lib/AST/FineGrainedDependenciesSourceFileDepGraphConstructor.cpp

Lines changed: 24 additions & 24 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;
@@ -594,27 +594,27 @@ class SourceFileDepGraphConstructor {
594594
declIsPrivate(p.getFirst().first)),
595595
p.getSecond()));
596596

597-
return SourceFileDepGraphConstructor(
598-
swiftDeps,
599-
includePrivateDeps,
600-
hadCompilationError,
601-
602-
getInterfaceHash(SF),
603-
topLevelDepends,
604-
memberDepends,
605-
dynamicLookupDepends,
606-
depTracker.getDependencies(),
607-
608-
namesForProvidersOfAGivenType<NodeKind::topLevel>(declFinder.precedenceGroups),
609-
namesForProvidersOfAGivenType<NodeKind::topLevel>(declFinder.memberOperatorDecls),
610-
namesForProvidersOfAGivenType<NodeKind::topLevel>(declFinder.operators),
611-
namesForProvidersOfAGivenType<NodeKind::topLevel>(declFinder.topNominals),
612-
namesForProvidersOfAGivenType<NodeKind::topLevel>(declFinder.topValues),
613-
namesForProvidersOfAGivenType<NodeKind::nominal>(declFinder.allNominals),
614-
namesForProvidersOfAGivenType<NodeKind::potentialMember>(declFinder.potentialMemberHolders),
615-
namesForProvidersOfAGivenType<NodeKind::member>(declFinder.valuesInExtensions),
616-
namesForProvidersOfAGivenType<NodeKind::dynamicLookup>(declFinder.classMembers)
617-
);
597+
return SourceFileDepGraphConstructor(
598+
swiftDeps,
599+
includePrivateDeps,
600+
hadCompilationError,
601+
602+
getInterfaceHash(SF),
603+
topLevelDepends,
604+
memberDepends,
605+
dynamicLookupDepends,
606+
depTracker.getDependencies(),
607+
608+
namesForProvidersOfAGivenType<NodeKind::topLevel>(declFinder.precedenceGroups),
609+
namesForProvidersOfAGivenType<NodeKind::topLevel>(declFinder.memberOperatorDecls),
610+
namesForProvidersOfAGivenType<NodeKind::topLevel>(declFinder.operators),
611+
namesForProvidersOfAGivenType<NodeKind::topLevel>(declFinder.topNominals),
612+
namesForProvidersOfAGivenType<NodeKind::topLevel>(declFinder.topValues),
613+
namesForProvidersOfAGivenType<NodeKind::nominal>(declFinder.allNominals),
614+
namesForProvidersOfAGivenType<NodeKind::potentialMember>(declFinder.potentialMemberHolders),
615+
namesForProvidersOfAGivenType<NodeKind::member>(declFinder.valuesInExtensions),
616+
namesForProvidersOfAGivenType<NodeKind::dynamicLookup>(declFinder.classMembers)
617+
);
618618
}
619619
// clang-format on
620620

@@ -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/IDE/CodeCompletion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks {
13071307
Component->getLoc() });
13081308
if (auto Module = Context.getLoadedModule(AccessPath))
13091309
ParsedTypeLoc.setType(ModuleType::get(Module));
1310-
return true;
1310+
return true;
13111311
}
13121312
return false;
13131313
}

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/SIL/DynamicCasts.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,9 +1161,9 @@ bool swift::canUseScalarCheckedCastInstructions(SILModule &M,
11611161
if (!objectType.isAnyClassReferenceType())
11621162
return false;
11631163

1164-
auto super = archetype->getSuperclass();
1165-
if (super.isNull())
1166-
return false;
1164+
auto super = archetype->getSuperclass();
1165+
if (super.isNull())
1166+
return false;
11671167

11681168
// A base class constraint that isn't NSError rules out the archetype being
11691169
// bound to NSError.

lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ SILValue DIMemoryObjectInfo::emitElementAddressForDestroy(
258258
// If we have a class, we can use a borrow directly and avoid ref
259259
// count traffic.
260260
if (isa<ClassDecl>(NTD) && Ptr->getType().isAddress()) {
261-
SILValue Original = Ptr;
262261
SILValue Borrowed = Ptr = B.createLoadBorrow(Loc, Ptr);
263262
EndScopeList.emplace_back(Borrowed, EndScopeKind::Borrow);
264263
}

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)