Skip to content

Commit 3dc5d78

Browse files
committed
Small enhancements
1 parent 8c258f4 commit 3dc5d78

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clang/lib/Sema/AnalysisBasedWarnings.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ struct TransferFunctions : public StmtVisitor<TransferFunctions> {
475475
Obj = MTE->getSubExpr();
476476
if (auto *DRE = dyn_cast<DeclRefExpr>(Obj)) {
477477
auto *D = dyn_cast<VarDecl>(DRE->getDecl());
478-
if (D->hasInit())
478+
if (D && D->hasInit())
479479
Obj = D->getInit();
480480
}
481481
Visit(Obj);
@@ -487,9 +487,8 @@ struct TransferFunctions : public StmtVisitor<TransferFunctions> {
487487
for (const LambdaCapture &Capture : LE->captures())
488488
if (Capture.capturesVariable())
489489
if (const VarDecl *VD = dyn_cast<VarDecl>(Capture.getCapturedVar()))
490-
if (VD == Var)
491-
if (Capture.getCaptureKind() == LCK_ByRef)
492-
AllValuesAreNoReturn = false;
490+
if (VD == Var && Capture.getCaptureKind() == LCK_ByRef)
491+
AllValuesAreNoReturn = false;
493492
}
494493

495494
void VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *MTE) {

0 commit comments

Comments
 (0)