@@ -547,7 +547,7 @@ struct CheckFallThroughDiagnostics {
547
547
unsigned diag_FallThrough_HasNoReturn;
548
548
unsigned diag_FallThrough_ReturnsNonVoid;
549
549
unsigned diag_NeverFallThroughOrReturn;
550
- enum { Function = 0 , Block, Lambda, Coroutine } funMode;
550
+ unsigned funMode; // TODO: use diag::FunModes
551
551
SourceLocation FuncLoc;
552
552
553
553
static CheckFallThroughDiagnostics MakeForFunction (const Decl *Func) {
@@ -572,7 +572,7 @@ struct CheckFallThroughDiagnostics {
572
572
else
573
573
D.diag_NeverFallThroughOrReturn = 0 ;
574
574
575
- D.funMode = Function;
575
+ D.funMode = diag::FunModes:: Function;
576
576
return D;
577
577
}
578
578
@@ -582,7 +582,7 @@ struct CheckFallThroughDiagnostics {
582
582
D.diag_FallThrough_HasNoReturn = 0 ;
583
583
D.diag_FallThrough_ReturnsNonVoid = diag::warn_falloff_nonvoid;
584
584
D.diag_NeverFallThroughOrReturn = 0 ;
585
- D.funMode = Coroutine;
585
+ D.funMode = diag::FunModes:: Coroutine;
586
586
return D;
587
587
}
588
588
@@ -591,7 +591,7 @@ struct CheckFallThroughDiagnostics {
591
591
D.diag_FallThrough_HasNoReturn = diag::err_noreturn_has_return_expr;
592
592
D.diag_FallThrough_ReturnsNonVoid = diag::err_falloff_nonvoid;
593
593
D.diag_NeverFallThroughOrReturn = 0 ;
594
- D.funMode = Block;
594
+ D.funMode = diag::FunModes:: Block;
595
595
return D;
596
596
}
597
597
@@ -600,13 +600,13 @@ struct CheckFallThroughDiagnostics {
600
600
D.diag_FallThrough_HasNoReturn = diag::err_noreturn_has_return_expr;
601
601
D.diag_FallThrough_ReturnsNonVoid = diag::warn_falloff_nonvoid;
602
602
D.diag_NeverFallThroughOrReturn = 0 ;
603
- D.funMode = Lambda;
603
+ D.funMode = diag::FunModes:: Lambda;
604
604
return D;
605
605
}
606
606
607
607
bool checkDiagnostics (DiagnosticsEngine &D, bool ReturnsVoid,
608
608
bool HasNoReturn) const {
609
- if (funMode == Function) {
609
+ if (funMode == diag::FunModes:: Function) {
610
610
return (ReturnsVoid ||
611
611
D.isIgnored (diag::warn_falloff_nonvoid, FuncLoc)) &&
612
612
(!HasNoReturn ||
@@ -615,7 +615,7 @@ struct CheckFallThroughDiagnostics {
615
615
(!ReturnsVoid ||
616
616
D.isIgnored (diag::warn_suggest_noreturn_block, FuncLoc));
617
617
}
618
- if (funMode == Coroutine) {
618
+ if (funMode == diag::FunModes:: Coroutine) {
619
619
return (ReturnsVoid ||
620
620
D.isIgnored (diag::warn_falloff_nonvoid, FuncLoc)) &&
621
621
(!HasNoReturn);
0 commit comments