Skip to content

Commit 661c30f

Browse files
authored
Merge pull request swiftlang#18963 from CodaFi/its-not-unusual-to-be-unused-by-anyone
[NFC] Silence a bunch of Wunused-variable diagnostics
2 parents 7501815 + 014fd95 commit 661c30f

21 files changed

+35
-35
lines changed

lib/AST/ASTVerifier.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,8 +1439,7 @@ class Verifier : public ASTWalker {
14391439
assert(knownConcreteErasure != ExistentialErasureOnly);
14401440
knownConcreteErasure = ConcreteErasureOnly;
14411441
concreteTy = concreteMeta->getInstanceType();
1442-
} else if (auto existentialMeta =
1443-
concreteTy->getAs<ExistentialMetatypeType>()) {
1442+
} else if (concreteTy->is<ExistentialMetatypeType>()) {
14441443
// If this is already forced to be a concrete erasure (say we're going
14451444
// from (P & Q).Type.Protocol to P.Type.Type), then this is invalid,
14461445
// because it would require the existential metatype to be

lib/AST/Decl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,7 +2054,7 @@ CanType ValueDecl::getOverloadSignatureType() const {
20542054
isMethod ? 2 : 1)->getCanonicalType();
20552055
}
20562056

2057-
if (auto *asd = dyn_cast<AbstractStorageDecl>(this)) {
2057+
if (isa<AbstractStorageDecl>(this)) {
20582058
// First, get the default overload signature type for the decl. For vars,
20592059
// this is the empty tuple type, as variables cannot be overloaded directly
20602060
// by type. For subscripts, it's their interface type.
@@ -5158,7 +5158,7 @@ AbstractFunctionDecl::getObjCSelector(DeclName preferredName) const {
51585158
} else if (auto func = dyn_cast<FuncDecl>(this)) {
51595159
// Otherwise cast this to be able to access getName()
51605160
baseNameStr = func->getName().str();
5161-
} else if (auto ctor = dyn_cast<ConstructorDecl>(this)) {
5161+
} else if (isa<ConstructorDecl>(this)) {
51625162
baseNameStr = "init";
51635163
} else {
51645164
llvm_unreachable("Unknown subclass of AbstractFunctionDecl");

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3431,7 +3431,7 @@ bool RewriteTreeNode::enumerateRulesRec(
34313431
lhs.push_back(assocType);
34323432

34333433
SWIFT_DEFER {
3434-
if (auto assocType = getMatch())
3434+
if (getMatch())
34353435
lhs.pop_back();
34363436
};
34373437

lib/AST/TypeJoinMeet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ CanType TypeJoin::visitStructType(CanType second) {
172172
assert(First != second);
173173

174174
// Deal with inout cases in visitInOutType.
175-
if (auto inoutTy = First->getAs<InOutType>())
175+
if (First->is<InOutType>())
176176
return TypeJoin(second).visit(First);
177177

178178
// FIXME: When possible we should return a protocol or protocol
@@ -233,7 +233,7 @@ CanType TypeJoin::visitBoundGenericStructType(CanType second) {
233233
assert(First != second);
234234

235235
// Deal with inout cases in visitInOutType.
236-
if (auto inoutTy = First->getAs<InOutType>())
236+
if (First->is<InOutType>())
237237
return TypeJoin(second).visit(First);
238238

239239
return Unimplemented;

lib/ClangImporter/SwiftLookupTable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ void SwiftLookupTable::addEntry(DeclName name, SingleEntry newEntry,
448448
auto contextOpt = translateContext(effectiveContext);
449449
if (!contextOpt) {
450450
// We might be able to resolve this later.
451-
if (auto decl = newEntry.dyn_cast<clang::NamedDecl *>()) {
451+
if (newEntry.is<clang::NamedDecl *>()) {
452452
UnresolvedEntries.push_back(
453453
std::make_tuple(name, newEntry, effectiveContext));
454454
}

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
281281
Opts.SolverShrinkUnsolvedThreshold = threshold;
282282
}
283283

284-
if (const Arg *A = Args.getLastArg(OPT_solver_disable_shrink))
284+
if (Args.getLastArg(OPT_solver_disable_shrink))
285285
Opts.SolverDisableShrink = true;
286286

287287
if (const Arg *A = Args.getLastArg(OPT_value_recursion_threshold)) {

lib/SIL/Linker.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,23 +157,26 @@ void SILLinkerVisitor::linkInVTable(ClassDecl *D) {
157157
// Visitors
158158
//===----------------------------------------------------------------------===//
159159

160+
static template<typename Inst>
161+
bool applyInstCalleeIsGeneric(Inst AI) {
162+
return AI->getCallee()->getType().template castTo<SILFunctionType>()
163+
->getGenericSignature();
164+
}
165+
160166
void SILLinkerVisitor::visitApplyInst(ApplyInst *AI) {
161-
if (auto sig = AI->getCallee()->getType().castTo<SILFunctionType>()
162-
->getGenericSignature()) {
167+
if (applyInstCalleeIsGeneric(AI)) {
163168
visitApplySubstitutions(AI->getSubstitutionMap());
164169
}
165170
}
166171

167172
void SILLinkerVisitor::visitTryApplyInst(TryApplyInst *TAI) {
168-
if (auto sig = TAI->getCallee()->getType().castTo<SILFunctionType>()
169-
->getGenericSignature()) {
173+
if (applyInstCalleeIsGeneric(TAI)) {
170174
visitApplySubstitutions(TAI->getSubstitutionMap());
171175
}
172176
}
173177

174178
void SILLinkerVisitor::visitPartialApplyInst(PartialApplyInst *PAI) {
175-
if (auto sig = PAI->getCallee()->getType().castTo<SILFunctionType>()
176-
->getGenericSignature()) {
179+
if (applyInstCalleeIsGeneric(PAI)) {
177180
visitApplySubstitutions(PAI->getSubstitutionMap());
178181
}
179182
}

lib/SIL/SILProfiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static bool canCreateProfilerForAST(ASTNode N) {
9999
assert(hasASTBeenTypeChecked(N) && "Cannot use this AST for profiling");
100100

101101
if (auto *D = N.dyn_cast<Decl *>()) {
102-
if (auto *AFD = dyn_cast<AbstractFunctionDecl>(D))
102+
if (isa<AbstractFunctionDecl>(D))
103103
return true;
104104

105105
if (isa<TopLevelCodeDecl>(D))

lib/SILGen/SILGenApply.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4440,7 +4440,7 @@ RValue SILGenFunction::emitApply(ResultPlanPtr &&resultPlan,
44404440

44414441
// If there's a foreign error parameter, fill it in.
44424442
ManagedValue errorTemp;
4443-
if (auto foreignError = calleeTypeInfo.foreignError) {
4443+
if (calleeTypeInfo.foreignError) {
44444444
unsigned errorParamIndex =
44454445
calleeTypeInfo.foreignError->getErrorParameterIndex();
44464446

lib/SILGen/SILGenBridging.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ SILGenFunction::emitBlockToFunc(SILLocation loc,
947947

948948
CanSILFunctionType substFnTy = thunkTy;
949949

950-
if (auto genericSig = thunkTy->getGenericSignature()) {
950+
if (thunkTy->getGenericSignature()) {
951951
substFnTy = thunkTy->substGenericArgs(F.getModule(),
952952
interfaceSubs);
953953
}

0 commit comments

Comments
 (0)