[cfe-commits] r61270 - /cfe/trunk/lib/Analysis/BugReporter.cpp

Ted Kremenek kremenek at apple.com
Fri Dec 19 17:41:45 PST 2008


Author: kremenek
Date: Fri Dec 19 19:41:43 2008
New Revision: 61270

URL: http://llvm.org/viewvc/llvm-project?rev=61270&view=rev
Log:
Fix <rdar://problem/6454568>: BugReporter should correctly handle switch statements with no default case.

Modified:
    cfe/trunk/lib/Analysis/BugReporter.cpp

Modified: cfe/trunk/lib/Analysis/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BugReporter.cpp?rev=61270&r1=61269&r2=61270&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Fri Dec 19 19:41:43 2008
@@ -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";
               





More information about the cfe-commits mailing list