diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-12-20 01:41:43 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-12-20 01:41:43 +0000 |
commit | 3ddc4d5f50dc6cd899ed07419413222c1d785d1c (patch) | |
tree | bbcab2a56d78d2269af5a4541960ecfce608986d /lib/Analysis/BugReporter.cpp | |
parent | e36dabb2d9567c98734a1063ac7748dc37a999ce (diff) |
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
Diffstat (limited to 'lib/Analysis/BugReporter.cpp')
-rw-r--r-- | lib/Analysis/BugReporter.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp index 8274ce71ff..e6840c3ad2 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/lib/Analysis/BugReporter.cpp @@ -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"; |