Skip to content

Commit de602ff

Browse files
committed
[Gardening] Fix some set but not used variables
1 parent 6b2fb2e commit de602ff

File tree

89 files changed

+171
-185
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

+171
-185
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
@@ -4704,7 +4704,7 @@ namespace {
47044704
} else if (auto *VD = originator.dyn_cast<VarDecl *>()) {
47054705
printFieldQuotedRaw([&](raw_ostream &OS) { VD->dumpRef(OS); }, "",
47064706
DeclColor);
4707-
} else if (auto *EE = originator.dyn_cast<ErrorExpr *>()) {
4707+
} else if (originator.is<ErrorExpr *>()) {
47084708
printFlag("error_expr");
47094709
} else if (auto *DMT = originator.dyn_cast<DependentMemberType *>()) {
47104710
printRec(DMT, "dependent_member_type");

lib/AST/ASTMangler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3050,7 +3050,7 @@ void ASTMangler::appendAnyGenericType(const GenericTypeDecl *decl,
30503050
appendIdentifier(interface->getObjCRuntimeNameAsString());
30513051
} else if (UseObjCRuntimeNames && protocol) {
30523052
appendIdentifier(protocol->getObjCRuntimeNameAsString());
3053-
} else if (auto ctsd = dyn_cast<clang::ClassTemplateSpecializationDecl>(namedDecl)) {
3053+
} else if (isa<clang::ClassTemplateSpecializationDecl>(namedDecl)) {
30543054
// If this is a `ClassTemplateSpecializationDecl`, it was
30553055
// imported as a Swift decl with `__CxxTemplateInst...` name.
30563056
// `ClassTemplateSpecializationDecl`'s name does not include information about
@@ -3247,7 +3247,7 @@ void ASTMangler::appendFunctionSignature(AnyFunctionType *fn,
32473247
appendOperator("YK");
32483248
}
32493249
}
3250-
switch (auto diffKind = fn->getDifferentiabilityKind()) {
3250+
switch (fn->getDifferentiabilityKind()) {
32513251
case DifferentiabilityKind::NonDifferentiable:
32523252
break;
32533253
case DifferentiabilityKind::Forward:
@@ -4158,11 +4158,11 @@ void ASTMangler::appendAccessorEntity(StringRef accessorKindCode,
41584158

41594159
BaseEntitySignature base(decl);
41604160
appendContextOf(decl, base);
4161-
if (auto *varDecl = dyn_cast<VarDecl>(decl)) {
4161+
if (isa<VarDecl>(decl)) {
41624162
appendDeclName(decl);
41634163
appendDeclType(decl, base);
41644164
appendOperator("v", accessorKindCode);
4165-
} else if (auto *subscriptDecl = dyn_cast<SubscriptDecl>(decl)) {
4165+
} else if (isa<SubscriptDecl>(decl)) {
41664166
appendDeclType(decl, base);
41674167

41684168
StringRef privateDiscriminator = getPrivateDiscriminatorIfNecessary(decl);
@@ -4957,7 +4957,7 @@ getPrecheckedLocalContextDiscriminator(const Decl *decl, Identifier name) {
49574957
std::string ASTMangler::mangleAttachedMacroExpansion(
49584958
const Decl *decl, CustomAttr *attr, MacroRole role) {
49594959
if (auto abiDecl = getABIDecl(decl)) {
4960-
return mangleAttachedMacroExpansion(decl, attr, role);
4960+
return mangleAttachedMacroExpansion(abiDecl, attr, role);
49614961
}
49624962

49634963
// 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;
@@ -4091,7 +4091,7 @@ void PrintAST::visitAccessorDecl(AccessorDecl *decl) {
40914091
// Explicitly print 'mutating' and 'nonmutating' if needed.
40924092
printSelfAccessKindModifiersIfNeeded(decl);
40934093

4094-
switch (auto kind = decl->getAccessorKind()) {
4094+
switch (decl->getAccessorKind()) {
40954095
case AccessorKind::Get:
40964096
case AccessorKind::DistributedGet:
40974097
case AccessorKind::Address:
@@ -4725,13 +4725,13 @@ void PrintAST::visitErrorExpr(ErrorExpr *expr) {
47254725

47264726
void PrintAST::visitTernaryExpr(TernaryExpr *expr) {
47274727
if (auto condExpr = expr->getCondExpr()) {
4728-
visit(expr->getCondExpr());
4728+
visit(condExpr);
47294729
}
47304730
Printer << " ? ";
47314731
visit(expr->getThenExpr());
47324732
Printer << " : ";
47334733
if (auto elseExpr = expr->getElseExpr()) {
4734-
visit(expr->getElseExpr());
4734+
visit(elseExpr);
47354735
}
47364736
}
47374737

@@ -6012,7 +6012,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
60126012
} else if (auto *VD = originator.dyn_cast<VarDecl *>()) {
60136013
Printer << "decl = ";
60146014
Printer << VD->getName();
6015-
} else if (auto *EE = originator.dyn_cast<ErrorExpr *>()) {
6015+
} else if (originator.is<ErrorExpr *>()) {
60166016
Printer << "error_expr";
60176017
} else if (auto *DMT = originator.dyn_cast<DependentMemberType *>()) {
60186018
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
@@ -1271,7 +1271,7 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
12711271

12721272
for (auto &origComponent : components) {
12731273
auto component = origComponent;
1274-
switch (auto kind = component.getKind()) {
1274+
switch (component.getKind()) {
12751275
case KeyPathExpr::Component::Kind::Subscript:
12761276
case KeyPathExpr::Component::Kind::UnresolvedSubscript: {
12771277
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
@@ -1640,7 +1640,7 @@ AccessLevel ImportDecl::getAccessLevel() const {
16401640
}
16411641

16421642
bool ImportDecl::isAccessLevelImplicit() const {
1643-
if (auto attr = getAttrs().getAttribute<AccessControlAttr>()) {
1643+
if (getAttrs().hasAttribute<AccessControlAttr>()) {
16441644
return false;
16451645
}
16461646
return true;
@@ -4620,7 +4620,7 @@ static AccessLevel getAdjustedFormalAccess(const ValueDecl *VD,
46204620
if (useDC) {
46214621
// If the use site decl context is PackageUnit, just return
46224622
// the access level that's passed in
4623-
if (auto usePkg = useDC->getPackageContext())
4623+
if (useDC->getPackageContext())
46244624
return access;
46254625
// Check whether we need to modify the access level based on
46264626
// @testable/@_private import attributes.
@@ -7951,7 +7951,7 @@ bool VarDecl::isMemberwiseInitialized(bool preferDeclaredProperties) const {
79517951
// memberwise initializable when it could be used to initialize
79527952
// other stored properties.
79537953
if (hasInitAccessor()) {
7954-
if (auto *init = getAccessor(AccessorKind::Init))
7954+
if (getAccessor(AccessorKind::Init))
79557955
return true;
79567956
}
79577957

@@ -11442,7 +11442,7 @@ ActorIsolation swift::getActorIsolationOfContext(
1144211442
return getClosureActorIsolation(closure);
1144311443
}
1144411444

11445-
if (auto *tld = dyn_cast<TopLevelCodeDecl>(dcToUse)) {
11445+
if (isa<TopLevelCodeDecl>(dcToUse)) {
1144611446
if (dcToUse->isAsyncContext() ||
1144711447
dcToUse->getASTContext().LangOpts.StrictConcurrencyLevel >=
1144811448
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
@@ -1978,7 +1978,7 @@ StringRef ModuleDecl::getModuleFilename() const {
19781978
continue;
19791979
}
19801980
// Skip synthesized files.
1981-
if (auto *SFU = dyn_cast<SynthesizedFileUnit>(F))
1981+
if (isa<SynthesizedFileUnit>(F))
19821982
continue;
19831983
return StringRef();
19841984
}

lib/AST/NameLookup.cpp

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

17911791
if (macro.getFreestanding()) {
17921792
inMacroArgument = true;
1793-
} else if (auto *attr = macro.getAttr()) {
1793+
} else if (macro.getAttr()) {
17941794
auto *moduleScope = sourceFile->getModuleScopeContext();
17951795
auto results =
17961796
lookupMacros(moduleScope, macro.getModuleName(),
@@ -1930,7 +1930,7 @@ PotentialMacroExpansions PotentialMacroExpansionsInContextRequest::evaluate(
19301930
dc->getModuleScopeContext(), med->getMacroName(),
19311931
MacroRole::Declaration, nameTracker);
19321932
} else if (auto *vd = dyn_cast<ValueDecl>(member)) {
1933-
nameTracker.attachedTo = dyn_cast<ValueDecl>(member);
1933+
nameTracker.attachedTo = vd;
19341934
forEachPotentialAttachedMacro(member, MacroRole::Peer, nameTracker);
19351935
}
19361936
}
@@ -2016,7 +2016,7 @@ populateLookupTableEntryFromMacroExpansions(ASTContext &ctx,
20162016
dc->getModuleScopeContext(), med->getMacroName(),
20172017
MacroRole::Declaration, nameTracker);
20182018
} else if (auto *vd = dyn_cast<ValueDecl>(member)) {
2019-
nameTracker.attachedTo = dyn_cast<ValueDecl>(member);
2019+
nameTracker.attachedTo = vd;
20202020
forEachPotentialAttachedMacro(member, MacroRole::Peer, nameTracker);
20212021
}
20222022

@@ -3610,7 +3610,7 @@ CollectedOpaqueReprs swift::collectOpaqueTypeReprs(TypeRepr *r, ASTContext &ctx,
36103610
if (!Ctx.LangOpts.hasFeature(Feature::ImplicitSome))
36113611
return Action::Continue();
36123612

3613-
if (auto existential = dyn_cast<ExistentialTypeRepr>(repr)) {
3613+
if (isa<ExistentialTypeRepr>(repr)) {
36143614
return Action::SkipNode();
36153615
} else if (auto composition = dyn_cast<CompositionTypeRepr>(repr)) {
36163616
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
@@ -5792,7 +5792,7 @@ synthesizeBaseClassFieldGetterOrAddressGetterBody(AbstractFunctionDecl *afd,
57925792
baseMemberDotCallExpr->setThrows(nullptr);
57935793

57945794
ArgumentList *argumentList;
5795-
if (auto subscript = dyn_cast<SubscriptDecl>(baseClassVar)) {
5795+
if (isa<SubscriptDecl>(baseClassVar)) {
57965796
auto paramDecl = getterDecl->getParameters()->get(0);
57975797
auto paramRefExpr = new (ctx) DeclRefExpr(paramDecl, DeclNameLoc(),
57985798
/*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

@@ -4140,8 +4139,7 @@ namespace {
41404139

41414140
if (decl->isVirtual()) {
41424141
if (auto funcDecl = dyn_cast_or_null<FuncDecl>(method)) {
4143-
if (auto structDecl =
4144-
dyn_cast_or_null<StructDecl>(method->getDeclContext())) {
4142+
if (isa_and_nonnull<StructDecl>(method->getDeclContext())) {
41454143
// If this is a method of a Swift struct, any possible override of
41464144
// this method would get sliced away, and an invocation would get
41474145
// dispatched statically. This is fine because it matches the C++
@@ -4153,8 +4151,7 @@ namespace {
41534151
"virtual function is not available in Swift "
41544152
"because it is pure");
41554153
}
4156-
} else if (auto classDecl = dyn_cast_or_null<ClassDecl>(
4157-
funcDecl->getDeclContext())) {
4154+
} else if (isa_and_nonnull<ClassDecl>(funcDecl->getDeclContext())) {
41584155
// This is a foreign reference type. Since `class T` on the Swift
41594156
// side is mapped from `T*` on the C++ side, an invocation of a
41604157
// 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
@@ -3254,7 +3254,7 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
32543254
if (auto A = Args.getLastArg(OPT_enable_round_trip_debug_types,
32553255
OPT_disable_round_trip_debug_types)) {
32563256
Opts.DisableRoundTripDebugTypes =
3257-
Args.hasArg(OPT_disable_round_trip_debug_types);
3257+
A->getOption().matches(OPT_disable_round_trip_debug_types);
32583258
}
32593259

32603260
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
@@ -6630,7 +6630,7 @@ llvm::FunctionType *FunctionPointer::getFunctionType() const {
66306630
}
66316631

66326632
// Read the function type off the global or else from the Signature.
6633-
if (auto *constant = dyn_cast<llvm::Constant>(Value)) {
6633+
if (isa<llvm::Constant>(Value)) {
66346634
auto *gv = dyn_cast<llvm::GlobalValue>(Value);
66356635
if (!gv) {
66366636
return Sig.getType();

0 commit comments

Comments
 (0)