Skip to content

Commit b92b4bb

Browse files
author
Igor S. Gerasimov
committed
Apply suggestions
1 parent 5ba28fc commit b92b4bb

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

clang/lib/Sema/AnalysisBasedWarnings.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -665,20 +665,19 @@ static void CheckFallThroughForBody(Sema &S, const Decl *D, const Stmt *Body,
665665
return;
666666

667667
// Either in a function body compound statement, or a function-try-block.
668-
int FallThroughType = CheckFallThrough(AC);
669-
switch (FallThroughType) {
668+
switch (int FallThroughType = CheckFallThrough(AC)) {
670669
case UnknownFallThrough:
671670
break;
672671

673672
case MaybeFallThrough:
674673
case AlwaysFallThrough:
675-
if (HasNoReturn && CD.diag_FallThrough_HasNoReturn != 0) {
676-
S.Diag(RBrace, CD.diag_FallThrough_HasNoReturn) << CD.FunMode;
677-
} else if (!ReturnsVoid && CD.diag_FallThrough_ReturnsNonVoid != 0) {
678-
unsigned NotInAllControlPath =
679-
FallThroughType == MaybeFallThrough ? 1 : 0;
674+
if (HasNoReturn) {
675+
if (CD.diag_FallThrough_HasNoReturn)
676+
S.Diag(RBrace, CD.diag_FallThrough_HasNoReturn) << CD.FunMode;
677+
} else if (!ReturnsVoid && CD.diag_FallThrough_ReturnsNonVoid) {
678+
bool NotInAllControlPaths = FallThroughType == MaybeFallThrough;
680679
S.Diag(RBrace, CD.diag_FallThrough_ReturnsNonVoid)
681-
<< CD.FunMode << NotInAllControlPath;
680+
<< CD.FunMode << NotInAllControlPaths;
682681
}
683682
break;
684683
case NeverFallThroughOrReturn:

0 commit comments

Comments
 (0)