Skip to content

Commit 34f9b80

Browse files
Merge pull request #78750 from AnthonyLatsis/oryza-sativa
[Gardening] Fix some set but not used variables
2 parents cac8297 + a84dfc8 commit 34f9b80

File tree

89 files changed

+169
-181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+169
-181
lines changed

lib/AST/ASTDemangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Type ASTBuilder::createNominalType(GenericTypeDecl *decl, Type parent) {
155155
return Type();
156156

157157
// If the declaration is generic, fail.
158-
if (auto list = nominalDecl->getGenericParams())
158+
if (nominalDecl->isGeneric())
159159
return Type();
160160

161161
// Imported types can be renamed to be members of other (non-generic)

lib/AST/ASTDumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5692,7 +5692,7 @@ namespace {
56925692
} else if (auto *VD = originator.dyn_cast<VarDecl *>()) {
56935693
printFieldQuotedRaw([&](raw_ostream &OS) { VD->dumpRef(OS); },
56945694
Label::optional("originating_var"), DeclColor);
5695-
} else if (auto *EE = originator.dyn_cast<ErrorExpr *>()) {
5695+
} else if (originator.is<ErrorExpr *>()) {
56965696
printFlag("error_expr");
56975697
} else if (auto *DMT = originator.dyn_cast<DependentMemberType *>()) {
56985698
printRec(DMT, Label::always("dependent_member_type"));

lib/AST/ASTMangler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,7 +3056,7 @@ void ASTMangler::appendAnyGenericType(const GenericTypeDecl *decl,
30563056
appendIdentifier(interface->getObjCRuntimeNameAsString());
30573057
} else if (UseObjCRuntimeNames && protocol) {
30583058
appendIdentifier(protocol->getObjCRuntimeNameAsString());
3059-
} else if (auto ctsd = dyn_cast<clang::ClassTemplateSpecializationDecl>(namedDecl)) {
3059+
} else if (isa<clang::ClassTemplateSpecializationDecl>(namedDecl)) {
30603060
// If this is a `ClassTemplateSpecializationDecl`, it was
30613061
// imported as a Swift decl with `__CxxTemplateInst...` name.
30623062
// `ClassTemplateSpecializationDecl`'s name does not include information about
@@ -3253,7 +3253,7 @@ void ASTMangler::appendFunctionSignature(AnyFunctionType *fn,
32533253
appendOperator("YK");
32543254
}
32553255
}
3256-
switch (auto diffKind = fn->getDifferentiabilityKind()) {
3256+
switch (fn->getDifferentiabilityKind()) {
32573257
case DifferentiabilityKind::NonDifferentiable:
32583258
break;
32593259
case DifferentiabilityKind::Forward:
@@ -4164,11 +4164,11 @@ void ASTMangler::appendAccessorEntity(StringRef accessorKindCode,
41644164

41654165
BaseEntitySignature base(decl);
41664166
appendContextOf(decl, base);
4167-
if (auto *varDecl = dyn_cast<VarDecl>(decl)) {
4167+
if (isa<VarDecl>(decl)) {
41684168
appendDeclName(decl);
41694169
appendDeclType(decl, base);
41704170
appendOperator("v", accessorKindCode);
4171-
} else if (auto *subscriptDecl = dyn_cast<SubscriptDecl>(decl)) {
4171+
} else if (isa<SubscriptDecl>(decl)) {
41724172
appendDeclType(decl, base);
41734173

41744174
StringRef privateDiscriminator = getPrivateDiscriminatorIfNecessary(decl);
@@ -4963,7 +4963,7 @@ getPrecheckedLocalContextDiscriminator(const Decl *decl, Identifier name) {
49634963
std::string ASTMangler::mangleAttachedMacroExpansion(
49644964
const Decl *decl, CustomAttr *attr, MacroRole role) {
49654965
if (auto abiDecl = getABIDecl(decl)) {
4966-
return mangleAttachedMacroExpansion(decl, attr, role);
4966+
return mangleAttachedMacroExpansion(abiDecl, attr, role);
49674967
}
49684968

49694969
// FIXME(kavon): using the decl causes a cycle. Is a null base fine?

lib/AST/ASTNode.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ bool ASTNode::isImplicit() const {
7979
return D->isImplicit();
8080
if (const auto *P = this->dyn_cast<Pattern*>())
8181
return P->isImplicit();
82-
if (const auto *T = this->dyn_cast<TypeRepr*>())
82+
if (this->is<TypeRepr *>())
8383
return false;
84-
if (const auto *C = this->dyn_cast<StmtConditionElement *>())
84+
if (this->is<StmtConditionElement *>())
8585
return false;
86-
if (const auto *I = this->dyn_cast<CaseLabelItem *>())
86+
if (this->is<CaseLabelItem *>())
8787
return false;
8888
llvm_unreachable("unsupported AST node");
8989
}
@@ -124,9 +124,9 @@ void ASTNode::dump(raw_ostream &OS, unsigned Indent) const {
124124
P->dump(OS, Indent);
125125
else if (auto T = dyn_cast<TypeRepr*>())
126126
T->print(OS);
127-
else if (auto *C = dyn_cast<StmtConditionElement *>())
127+
else if (is<StmtConditionElement *>())
128128
OS.indent(Indent) << "(statement condition)";
129-
else if (auto *I = dyn_cast<CaseLabelItem *>()) {
129+
else if (is<CaseLabelItem *>()) {
130130
OS.indent(Indent) << "(case label item)";
131131
} else
132132
llvm_unreachable("unsupported AST node");

lib/AST/ASTPrinter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static bool isPrespecilizationDeclWithTarget(const ValueDecl *vd) {
151151
for (auto *attr : vd->getAttrs().getAttributes<SpecializeAttr>()) {
152152
if (!attr->isExported())
153153
continue;
154-
if (auto *targetFun = attr->getTargetFunctionDecl(vd))
154+
if (attr->getTargetFunctionDecl(vd))
155155
return true;
156156
}
157157
return false;
@@ -4136,7 +4136,7 @@ void PrintAST::visitAccessorDecl(AccessorDecl *decl) {
41364136
// Explicitly print 'mutating' and 'nonmutating' if needed.
41374137
printSelfAccessKindModifiersIfNeeded(decl);
41384138

4139-
switch (auto kind = decl->getAccessorKind()) {
4139+
switch (decl->getAccessorKind()) {
41404140
case AccessorKind::Get:
41414141
case AccessorKind::DistributedGet:
41424142
case AccessorKind::Address:
@@ -4773,13 +4773,13 @@ void PrintAST::visitErrorExpr(ErrorExpr *expr) {
47734773

47744774
void PrintAST::visitTernaryExpr(TernaryExpr *expr) {
47754775
if (auto condExpr = expr->getCondExpr()) {
4776-
visit(expr->getCondExpr());
4776+
visit(condExpr);
47774777
}
47784778
Printer << " ? ";
47794779
visit(expr->getThenExpr());
47804780
Printer << " : ";
47814781
if (auto elseExpr = expr->getElseExpr()) {
4782-
visit(expr->getElseExpr());
4782+
visit(elseExpr);
47834783
}
47844784
}
47854785

@@ -6060,7 +6060,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
60606060
} else if (auto *VD = originator.dyn_cast<VarDecl *>()) {
60616061
Printer << "decl = ";
60626062
Printer << VD->getName();
6063-
} else if (auto *EE = originator.dyn_cast<ErrorExpr *>()) {
6063+
} else if (originator.is<ErrorExpr *>()) {
60646064
Printer << "error_expr";
60656065
} else if (auto *DMT = originator.dyn_cast<DependentMemberType *>()) {
60666066
visit(DMT);

lib/AST/ASTVerifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ class Verifier : public ASTWalker {
11021102
resultType = FD->mapTypeIntoContext(resultType);
11031103
} else if (auto closure = dyn_cast<AbstractClosureExpr>(func)) {
11041104
resultType = closure->getResultType();
1105-
} else if (auto *CD = dyn_cast<ConstructorDecl>(func)) {
1105+
} else if (isa<ConstructorDecl>(func)) {
11061106
resultType = TupleType::getEmpty(Ctx);
11071107
} else {
11081108
resultType = TupleType::getEmpty(Ctx);

lib/AST/ASTWalker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
12811281

12821282
for (auto &origComponent : components) {
12831283
auto component = origComponent;
1284-
switch (auto kind = component.getKind()) {
1284+
switch (component.getKind()) {
12851285
case KeyPathExpr::Component::Kind::Subscript:
12861286
case KeyPathExpr::Component::Kind::UnresolvedSubscript: {
12871287
if (auto *newArgs = doIt(component.getSubscriptArgs())) {

lib/AST/Attr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void OpenedTypeAttr::printImpl(ASTPrinter &printer,
267267
printer << "(\"" << getUUID() << "\"";
268268
if (auto constraintType = getConstraintType()) {
269269
printer << ", ";
270-
getConstraintType()->print(printer, options);
270+
constraintType->print(printer, options);
271271
}
272272
printer << ")";
273273
printer.printStructurePost(PrintStructureKind::BuiltinAttribute);

lib/AST/Decl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,7 @@ AccessLevel ImportDecl::getAccessLevel() const {
17011701
}
17021702

17031703
bool ImportDecl::isAccessLevelImplicit() const {
1704-
if (auto attr = getAttrs().getAttribute<AccessControlAttr>()) {
1704+
if (getAttrs().hasAttribute<AccessControlAttr>()) {
17051705
return false;
17061706
}
17071707
return true;
@@ -4688,7 +4688,7 @@ static AccessLevel getAdjustedFormalAccess(const ValueDecl *VD,
46884688
if (useDC) {
46894689
// If the use site decl context is PackageUnit, just return
46904690
// the access level that's passed in
4691-
if (auto usePkg = useDC->getPackageContext())
4691+
if (useDC->getPackageContext())
46924692
return access;
46934693
// Check whether we need to modify the access level based on
46944694
// @testable/@_private import attributes.
@@ -8024,7 +8024,7 @@ bool VarDecl::isMemberwiseInitialized(bool preferDeclaredProperties) const {
80248024
// memberwise initializable when it could be used to initialize
80258025
// other stored properties.
80268026
if (hasInitAccessor()) {
8027-
if (auto *init = getAccessor(AccessorKind::Init))
8027+
if (getAccessor(AccessorKind::Init))
80288028
return true;
80298029
}
80308030

@@ -11528,7 +11528,7 @@ ActorIsolation swift::getActorIsolationOfContext(
1152811528
return getClosureActorIsolation(closure);
1152911529
}
1153011530

11531-
if (auto *tld = dyn_cast<TopLevelCodeDecl>(dcToUse)) {
11531+
if (isa<TopLevelCodeDecl>(dcToUse)) {
1153211532
if (dcToUse->isAsyncContext() ||
1153311533
dcToUse->getASTContext().LangOpts.StrictConcurrencyLevel >=
1153411534
StrictConcurrency::Complete) {

lib/AST/DistributedDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Type swift::getConcreteReplacementForProtocolActorSystemType(
169169
}
170170

171171
/// === Maybe the value is declared in a protocol?
172-
if (auto protocol = DC->getSelfProtocolDecl()) {
172+
if (DC->getSelfProtocolDecl()) {
173173
GenericSignature signature;
174174
if (auto *genericContext = anyValue->getAsGenericContext()) {
175175
signature = genericContext->getGenericSignature();

lib/AST/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1991,7 +1991,7 @@ StringRef ModuleDecl::getModuleFilename() const {
19911991
continue;
19921992
}
19931993
// Skip synthesized files.
1994-
if (auto *SFU = dyn_cast<SynthesizedFileUnit>(F))
1994+
if (isa<SynthesizedFileUnit>(F))
19951995
continue;
19961996
return StringRef();
19971997
}

lib/AST/NameLookup.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ namelookup::isInMacroArgument(SourceFile *sourceFile, SourceLoc loc) {
17741774

17751775
if (macro.getFreestanding()) {
17761776
inMacroArgument = true;
1777-
} else if (auto *attr = macro.getAttr()) {
1777+
} else if (macro.getAttr()) {
17781778
auto *moduleScope = sourceFile->getModuleScopeContext();
17791779
auto results =
17801780
lookupMacros(moduleScope, macro.getModuleName(),
@@ -1914,7 +1914,7 @@ PotentialMacroExpansions PotentialMacroExpansionsInContextRequest::evaluate(
19141914
dc->getModuleScopeContext(), med->getMacroName(),
19151915
MacroRole::Declaration, nameTracker);
19161916
} else if (auto *vd = dyn_cast<ValueDecl>(member)) {
1917-
nameTracker.attachedTo = dyn_cast<ValueDecl>(member);
1917+
nameTracker.attachedTo = vd;
19181918
forEachPotentialAttachedMacro(member, MacroRole::Peer, nameTracker);
19191919
}
19201920
}
@@ -2000,7 +2000,7 @@ populateLookupTableEntryFromMacroExpansions(ASTContext &ctx,
20002000
dc->getModuleScopeContext(), med->getMacroName(),
20012001
MacroRole::Declaration, nameTracker);
20022002
} else if (auto *vd = dyn_cast<ValueDecl>(member)) {
2003-
nameTracker.attachedTo = dyn_cast<ValueDecl>(member);
2003+
nameTracker.attachedTo = vd;
20042004
forEachPotentialAttachedMacro(member, MacroRole::Peer, nameTracker);
20052005
}
20062006

@@ -3606,7 +3606,7 @@ CollectedOpaqueReprs swift::collectOpaqueTypeReprs(TypeRepr *r, ASTContext &ctx,
36063606
if (!Ctx.LangOpts.hasFeature(Feature::ImplicitSome))
36073607
return Action::Continue();
36083608

3609-
if (auto existential = dyn_cast<ExistentialTypeRepr>(repr)) {
3609+
if (isa<ExistentialTypeRepr>(repr)) {
36103610
return Action::SkipNode();
36113611
} else if (auto composition = dyn_cast<CompositionTypeRepr>(repr)) {
36123612
if (!composition->isTypeReprAny())

lib/AST/SubstitutionMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ SubstitutionMap::getOverrideSubstitutions(
406406
const ValueDecl *baseDecl,
407407
const ValueDecl *derivedDecl) {
408408
// For overrides within a protocol hierarchy, substitute the Self type.
409-
if (auto baseProto = baseDecl->getDeclContext()->getSelfProtocolDecl()) {
409+
if (baseDecl->getDeclContext()->getSelfProtocolDecl()) {
410410
auto baseSig = baseDecl->getInnermostDeclContext()
411411
->getGenericSignatureOfContext();
412412
return baseSig->getIdentitySubstitutionMap();

lib/AST/TypeSubstitution.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ operator()(CanType dependentType, Type conformingReplacementType,
105105
ProtocolDecl *conformedProtocol) const {
106106
// Lookup conformances for archetypes that conform concretely
107107
// via a superclass.
108-
if (auto archetypeType = conformingReplacementType->getAs<ArchetypeType>()) {
108+
if (conformingReplacementType->is<ArchetypeType>()) {
109109
return lookupConformance(
110110
conformingReplacementType, conformedProtocol,
111111
/*allowMissing=*/true);
@@ -667,7 +667,7 @@ SubstitutionMap TypeBase::getContextSubstitutionMap() {
667667
}
668668

669669
// This case indicates we have invalid nesting of types.
670-
if (auto protocolTy = baseTy->getAs<ProtocolType>()) {
670+
if (baseTy->is<ProtocolType>()) {
671671
if (!first)
672672
break;
673673

lib/ClangImporter/ClangImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5800,7 +5800,7 @@ synthesizeBaseClassFieldGetterOrAddressGetterBody(AbstractFunctionDecl *afd,
58005800
baseMemberDotCallExpr->setThrows(nullptr);
58015801

58025802
ArgumentList *argumentList;
5803-
if (auto subscript = dyn_cast<SubscriptDecl>(baseClassVar)) {
5803+
if (isa<SubscriptDecl>(baseClassVar)) {
58045804
auto paramDecl = getterDecl->getParameters()->get(0);
58055805
auto paramRefExpr = new (ctx) DeclRefExpr(paramDecl, DeclNameLoc(),
58065806
/*Implicit=*/true);

lib/ClangImporter/ImportDecl.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,7 @@ void ClangImporter::Implementation::addSynthesizedProtocolAttrs(
484484
// ctx.getProtocol(kind) != nulltpr which would be nice.
485485
if (auto proto = ctx.getProtocol(kind))
486486
nominal->getAttrs().add(
487-
new (ctx) SynthesizedProtocolAttr(ctx.getProtocol(kind), this,
488-
isUnchecked));
487+
new (ctx) SynthesizedProtocolAttr(proto, this, isUnchecked));
489488
}
490489
}
491490

@@ -4212,8 +4211,7 @@ namespace {
42124211

42134212
if (decl->isVirtual()) {
42144213
if (auto funcDecl = dyn_cast_or_null<FuncDecl>(method)) {
4215-
if (auto structDecl =
4216-
dyn_cast_or_null<StructDecl>(method->getDeclContext())) {
4214+
if (isa_and_nonnull<StructDecl>(method->getDeclContext())) {
42174215
// If this is a method of a Swift struct, any possible override of
42184216
// this method would get sliced away, and an invocation would get
42194217
// dispatched statically. This is fine because it matches the C++
@@ -4225,8 +4223,7 @@ namespace {
42254223
"virtual function is not available in Swift "
42264224
"because it is pure");
42274225
}
4228-
} else if (auto classDecl = dyn_cast_or_null<ClassDecl>(
4229-
funcDecl->getDeclContext())) {
4226+
} else if (isa_and_nonnull<ClassDecl>(funcDecl->getDeclContext())) {
42304227
// This is a foreign reference type. Since `class T` on the Swift
42314228
// side is mapped from `T*` on the C++ side, an invocation of a
42324229
// virtual method `t->method()` should get dispatched dynamically.

lib/Driver/ToolChains.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
204204
arguments.push_back("-disable-objc-interop");
205205
}
206206

207-
if (const Arg *arg = inputArgs.getLastArg(
208-
options::OPT_experimental_serialize_debug_info)) {
207+
if (inputArgs.getLastArg(options::OPT_experimental_serialize_debug_info)) {
209208
arguments.push_back(
210209
inputArgs.MakeArgString(Twine("-experimental-serialize-debug-info")));
211210
}

lib/DriverTool/autolink_extract_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static bool extractLinkerFlags(const llvm::object::Binary *Bin,
188188
}
189189
}
190190
return bool(Error);
191-
} else if (auto *IRObjectFile = llvm::dyn_cast<llvm::object::IRObjectFile>(Bin)) {
191+
} else if (llvm::isa<llvm::object::IRObjectFile>(Bin)) {
192192
// Ignore the LLVM IR files (LTO)
193193
return false;
194194
} else {

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3252,7 +3252,7 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
32523252
if (auto A = Args.getLastArg(OPT_enable_round_trip_debug_types,
32533253
OPT_disable_round_trip_debug_types)) {
32543254
Opts.DisableRoundTripDebugTypes =
3255-
Args.hasArg(OPT_disable_round_trip_debug_types);
3255+
A->getOption().matches(OPT_disable_round_trip_debug_types);
32563256
}
32573257

32583258
if (Args.hasArg(OPT_disable_debugger_shadow_copies))

lib/IDE/CompletionLookup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ Type CompletionLookup::getAssociatedTypeType(const AssociatedTypeDecl *ATD) {
771771
CurrDeclContext->getInnermostTypeContext()->getDeclaredTypeInContext();
772772
if (BaseTy) {
773773
BaseTy = BaseTy->getInOutObjectType()->getMetatypeInstanceType();
774-
if (auto NTD = BaseTy->getAnyNominal()) {
774+
if (BaseTy->getAnyNominal()) {
775775
auto Conformance = lookupConformance(BaseTy, ATD->getProtocol());
776776
if (Conformance.isConcrete()) {
777777
return Conformance.getConcrete()->getTypeWitness(

lib/IDE/Formatting.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ class RangeWalker: protected ASTWalker {
524524
SourceRange Braces(PGD->getLBraceLoc(), PGD->getRBraceLoc());
525525
if (!handleBraces(Braces, ContextLoc))
526526
return Action::Stop();
527-
} else if (auto *PDD = dyn_cast<PoundDiagnosticDecl>(D)) {
527+
} else if (isa<PoundDiagnosticDecl>(D)) {
528528
// TODO: add paren locations to PoundDiagnosticDecl
529529
}
530530

@@ -580,7 +580,7 @@ class RangeWalker: protected ASTWalker {
580580
} else if (auto *WS = dyn_cast<WhileStmt>(S)) {
581581
if (!handleBraceStmt(WS->getBody(), WS->getWhileLoc()))
582582
return Action::Stop();
583-
} else if (auto *PAS = dyn_cast<PoundAssertStmt>(S)) {
583+
} else if (isa<PoundAssertStmt>(S)) {
584584
// TODO: add paren locations to PoundAssertStmt
585585
}
586586

lib/IDE/SourceEntityWalker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ bool SemaAnnotator::shouldIgnore(Decl *D) {
967967
// Walk into missing decls to visit their attributes if they were generated
968968
// by a member attribute expansion. Note that we would have already skipped
969969
// this decl if we were ignoring expansions, so no need to check that.
970-
if (auto *missing = dyn_cast<MissingDecl>(D)) {
970+
if (isa<MissingDecl>(D)) {
971971
if (D->isInMacroExpansionInContext())
972972
return false;
973973
}

lib/IRGen/GenArchetype.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ const TypeInfo *TypeConverter::convertArchetypeType(ArchetypeType *archetype) {
405405
// Opaque result types can be private and from a different module. In this
406406
// case we can't access their type metadata from another module.
407407
IsABIAccessible_t abiAccessible = IsABIAccessible;
408-
if (auto opaqueArchetype = dyn_cast<OpaqueTypeArchetypeType>(archetype)) {
408+
if (isa<OpaqueTypeArchetypeType>(archetype)) {
409409
auto &currentSILModule = IGM.getSILModule();
410410
abiAccessible =
411411
currentSILModule.isTypeMetadataAccessible(archetype->getCanonicalType())

lib/IRGen/GenCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6620,7 +6620,7 @@ llvm::FunctionType *FunctionPointer::getFunctionType() const {
66206620
}
66216621

66226622
// Read the function type off the global or else from the Signature.
6623-
if (auto *constant = dyn_cast<llvm::Constant>(Value)) {
6623+
if (isa<llvm::Constant>(Value)) {
66246624
auto *gv = dyn_cast<llvm::GlobalValue>(Value);
66256625
if (!gv) {
66266626
return Sig.getType();

0 commit comments

Comments
 (0)