[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Nov 19 18:10:02 PST 2003
Changes in directory llvm/lib/VMCore:
AsmWriter.cpp updated: 1.111 -> 1.112
---
Log message:
Don't crash if we are printing an orphaned basic block!
---
Diffs of the changes: (+17 -13)
Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.111 llvm/lib/VMCore/AsmWriter.cpp:1.112
--- llvm/lib/VMCore/AsmWriter.cpp:1.111 Sun Nov 16 19:17:04 2003
+++ llvm/lib/VMCore/AsmWriter.cpp Wed Nov 19 18:09:43 2003
@@ -750,20 +750,24 @@
else
Out << "<badref>";
}
-
- if (BB != &BB->getParent()->front()) { // Not the entry block?
- // Output predecessors for the block...
- Out << "\t\t;";
- pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB);
-
- if (PI == PE) {
- Out << " No predecessors!";
- } else {
- Out << " preds =";
- writeOperand(*PI, false, true);
- for (++PI; PI != PE; ++PI) {
- Out << ",";
+
+ if (BB->getParent() == 0)
+ Out << "\t\t; Error: Block without parent!";
+ else {
+ if (BB != &BB->getParent()->front()) { // Not the entry block?
+ // Output predecessors for the block...
+ Out << "\t\t;";
+ pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB);
+
+ if (PI == PE) {
+ Out << " No predecessors!";
+ } else {
+ Out << " preds =";
writeOperand(*PI, false, true);
+ for (++PI; PI != PE; ++PI) {
+ Out << ",";
+ writeOperand(*PI, false, true);
+ }
}
}
}
More information about the llvm-commits
mailing list