[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Oct 13 15:33:02 PDT 2003


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.131 -> 1.132

---
Log message:

Do not allow fallthroughs in switch statements.  This fixes PR37, 
253.perlbmk, and test/Programs/SingleSource/UnitTests/2003-10-13-SwitchTest.c!


---
Diffs of the changes:  (+3 -1)

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.131 llvm/lib/CWriter/Writer.cpp:1.132
--- llvm/lib/CWriter/Writer.cpp:1.131	Mon Oct 13 12:13:53 2003
+++ llvm/lib/CWriter/Writer.cpp	Mon Oct 13 15:32:04 2003
@@ -1057,7 +1057,9 @@
     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";





More information about the llvm-commits mailing list