Do not allow fallthroughs in switch statements. This fixes PR37,

253.perlbmk, and test/Programs/SingleSource/UnitTests/2003-10-13-SwitchTest.c!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9101 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-10-13 20:32:04 +00:00
parent d12fa6c104
commit 3875657ee5
2 changed files with 6 additions and 2 deletions

View File

@ -1057,7 +1057,9 @@ void CWriter::printBranchToBlock(BasicBlock *CurBB, BasicBlock *Succ,
Out << "; /* for PHI node */\n";
}
if (CurBB->getNext() != Succ || isa<InvokeInst>(CurBB->getTerminator())) {
if (CurBB->getNext() != Succ ||
isa<InvokeInst>(CurBB->getTerminator()) ||
isa<SwitchInst>(CurBB->getTerminator())) {
Out << std::string(Indent, ' ') << " goto ";
writeOperand(Succ);
Out << ";\n";

View File

@ -1057,7 +1057,9 @@ void CWriter::printBranchToBlock(BasicBlock *CurBB, BasicBlock *Succ,
Out << "; /* for PHI node */\n";
}
if (CurBB->getNext() != Succ || isa<InvokeInst>(CurBB->getTerminator())) {
if (CurBB->getNext() != Succ ||
isa<InvokeInst>(CurBB->getTerminator()) ||
isa<SwitchInst>(CurBB->getTerminator())) {
Out << std::string(Indent, ' ') << " goto ";
writeOperand(Succ);
Out << ";\n";