diff options
author | Chris Lattner <sabre@nondot.org> | 2003-10-13 20:32:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-10-13 20:32:04 +0000 |
commit | 3875657ee5eef43707b8481143df7630b689432b (patch) | |
tree | 57fb9bf163189dbea3ba9fbdca0d0e88335f76a1 /lib/Target/CBackend/CBackend.cpp | |
parent | d12fa6c1045c80e314dbc3be3a2d7b45652a62ad (diff) |
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
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index dea97e92f9..a3607be8a0 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -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"; |