Fix <rdar://problem/6454568>: BugReporter should correctly handle switch statements with no default case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61270 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index 8274ce7..e6840c3 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -549,12 +549,14 @@
if (Stmt* S = Dst->getLabel())
switch (S->getStmtClass()) {
- default:
- assert(false && "Not a valid switch label.");
- continue;
+ default: {
+ os << "No cases match in the switch statement. "
+ "Control jumps to line "
+ << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
+ break;
+ }
- case Stmt::DefaultStmtClass: {
-
+ case Stmt::DefaultStmtClass: {
os << "Control jumps to the 'default' case at line "
<< SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";