Skip to content

Commit 66f2733

Browse files
committed
[Gardening] Use cast results where possible
1 parent 0e6dc0c commit 66f2733

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lib/SIL/LinearLifetimeChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void State::initializeConsumingUse(BranchPropagatedUser consumingUser,
219219
llvm::errs() << "Function: '" << beginBlock->getParent()->getName() << "'\n"
220220
<< "Found over consume?!\n";
221221
if (auto v = value) {
222-
llvm::errs() << "Value: " << *value;
222+
llvm::errs() << "Value: " << *v;
223223
} else {
224224
llvm::errs() << "Value: N/A\n";
225225
}

lib/Sema/CSDiag.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,8 +1297,8 @@ void FailureDiagnosis::diagnoseAmbiguity(Expr *E) {
12971297
// Unresolved/Anonymous ClosureExprs are common enough that we should give
12981298
// them tailored diagnostics.
12991299
if (auto CE = dyn_cast<ClosureExpr>(E->getValueProvidingExpr())) {
1300-
diagnose(E->getLoc(), diag::cannot_infer_closure_type)
1301-
.highlight(E->getSourceRange());
1300+
diagnose(CE->getLoc(), diag::cannot_infer_closure_type)
1301+
.highlight(CE->getSourceRange());
13021302
return;
13031303
}
13041304

lib/Sema/TypeCheckAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2931,7 +2931,7 @@ DynamicallyReplacedDeclRequest::evaluate(Evaluator &evaluator,
29312931

29322932
// If we can lazily resolve the function, do so now.
29332933
if (auto *LazyResolver = attr->Resolver) {
2934-
auto decl = attr->Resolver->loadDynamicallyReplacedFunctionDecl(
2934+
auto decl = LazyResolver->loadDynamicallyReplacedFunctionDecl(
29352935
attr, attr->ResolverContextData);
29362936
attr->Resolver = nullptr;
29372937
return decl;

lib/Sema/TypeCheckDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ IsFinalRequest::evaluate(Evaluator &evaluator, ValueDecl *decl) const {
578578
VD->getOriginalWrappedProperty(PropertyWrapperSynthesizedPropertyKind::Backing))
579579
return true;
580580

581-
if (auto *nominalDecl = VD->getDeclContext()->getSelfClassDecl()) {
581+
if (VD->getDeclContext()->getSelfClassDecl()) {
582582
// If this variable is a class member, mark it final if the
583583
// class is final, or if it was declared with 'let'.
584584
auto *PBD = VD->getParentPatternBinding();

0 commit comments

Comments
 (0)