Skip to content

Commit 146642e

Browse files
author
Igor S. Gerasimov
committed
Use default values in CheckFallThroughDiagnostics structure
1 parent 5d20d27 commit 146642e

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

clang/lib/Sema/AnalysisBasedWarnings.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,9 @@ static ControlFlowKind CheckFallThrough(AnalysisDeclContext &AC) {
544544
namespace {
545545

546546
struct CheckFallThroughDiagnostics {
547-
unsigned diag_FallThrough_HasNoReturn;
548-
unsigned diag_FallThrough_ReturnsNonVoid;
549-
unsigned diag_NeverFallThroughOrReturn;
547+
unsigned diag_FallThrough_HasNoReturn = 0;
548+
unsigned diag_FallThrough_ReturnsNonVoid = 0;
549+
unsigned diag_NeverFallThroughOrReturn = 0;
550550
unsigned funMode; // TODO: use diag::FunModes
551551
SourceLocation FuncLoc;
552552

@@ -569,8 +569,6 @@ struct CheckFallThroughDiagnostics {
569569

570570
if (!isVirtualMethod && !isTemplateInstantiation)
571571
D.diag_NeverFallThroughOrReturn = diag::warn_suggest_noreturn_function;
572-
else
573-
D.diag_NeverFallThroughOrReturn = 0;
574572

575573
D.funMode = diag::FunModes::Function;
576574
return D;
@@ -579,9 +577,7 @@ struct CheckFallThroughDiagnostics {
579577
static CheckFallThroughDiagnostics MakeForCoroutine(const Decl *Func) {
580578
CheckFallThroughDiagnostics D;
581579
D.FuncLoc = Func->getLocation();
582-
D.diag_FallThrough_HasNoReturn = 0;
583580
D.diag_FallThrough_ReturnsNonVoid = diag::warn_falloff_nonvoid;
584-
D.diag_NeverFallThroughOrReturn = 0;
585581
D.funMode = diag::FunModes::Coroutine;
586582
return D;
587583
}
@@ -590,7 +586,6 @@ struct CheckFallThroughDiagnostics {
590586
CheckFallThroughDiagnostics D;
591587
D.diag_FallThrough_HasNoReturn = diag::err_noreturn_has_return_expr;
592588
D.diag_FallThrough_ReturnsNonVoid = diag::err_falloff_nonvoid;
593-
D.diag_NeverFallThroughOrReturn = 0;
594589
D.funMode = diag::FunModes::Block;
595590
return D;
596591
}
@@ -599,7 +594,6 @@ struct CheckFallThroughDiagnostics {
599594
CheckFallThroughDiagnostics D;
600595
D.diag_FallThrough_HasNoReturn = diag::err_noreturn_has_return_expr;
601596
D.diag_FallThrough_ReturnsNonVoid = diag::warn_falloff_nonvoid;
602-
D.diag_NeverFallThroughOrReturn = 0;
603597
D.funMode = diag::FunModes::Lambda;
604598
return D;
605599
}

0 commit comments

Comments
 (0)