]> granicus.if.org Git - clang/commitdiff
Fix <rdar://problem/6454568>: BugReporter should correctly handle switch statements...
authorTed Kremenek <kremenek@apple.com>
Sat, 20 Dec 2008 01:41:43 +0000 (01:41 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 20 Dec 2008 01:41:43 +0000 (01:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61270 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/BugReporter.cpp

index 8274ce71ffe98bd88bfd740798d3b6fed97a61de..e6840c3ad259a182446e47184a97a42a71e932b1 100644 (file)
@@ -549,12 +549,14 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
           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";