int AnnotatedCnt;
for (CFG::reverse_iterator I = Cfg->rbegin(), E = Cfg->rend(); I != E; ++I) {
- const CFGBlock &B = **I;
- const Stmt *Label = B.getLabel();
+ const CFGBlock *B = *I;
+ const Stmt *Label = B->getLabel();
if (!Label || !isa<SwitchCase>(Label))
continue;
- if (!FM.checkFallThroughIntoBlock(B, AnnotatedCnt))
+ if (!FM.checkFallThroughIntoBlock(*B, AnnotatedCnt))
continue;
S.Diag(Label->getLocStart(),
if (L.isMacroID())
continue;
if (S.getLangOpts().CPlusPlus11) {
- const Stmt *Term = B.getTerminator();
- if (!(B.empty() && Term && isa<BreakStmt>(Term))) {
+ const Stmt *Term = B->getTerminator();
+ // Skip empty cases.
+ while (B->empty() && !Term && B->succ_size() == 1) {
+ B = *B->succ_begin();
+ Term = B->getTerminator();
+ }
+ if (!(B->empty() && Term && isa<BreakStmt>(Term))) {
Preprocessor &PP = S.getPreprocessor();
TokenValue Tokens[] = {
tok::l_square, tok::l_square, PP.getIdentifierInfo("clang"),