Change 'switch' not to fall through between empty cases and always require at

least one statement per case

rdar://16301313


Swift SVN r15266
This commit is contained in:
Dmitri Hrybenko
2014-03-20 11:44:59 +00:00
parent bf2568f8e9
commit 11fea869c1
16 changed files with 402 additions and 407 deletions

View File

@@ -1818,10 +1818,10 @@ void SILGenFunction::emitSwitchStmt(SwitchStmt *S) {
for (auto *caseBlock : S->getCases()) {
caseMap[caseBlock] = {};
for (auto *label : caseBlock->getCaseLabels())
for (auto *pattern : label->getPatterns())
clauses.addRow(caseBlock, label->getGuardExpr(), pattern,
CleanupsDepth::invalid(), contBB);
for (const auto &labelItem : caseBlock->getCaseLabelItems())
clauses.addRow(caseBlock, const_cast<Expr *>(labelItem.getGuardExpr()),
labelItem.getPattern(),
CleanupsDepth::invalid(), contBB);
}
// Bind variable bindings from the topmost pattern nodes.