diff options
author | Anna Zaks <ganna@apple.com> | 2012-02-16 03:41:01 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-02-16 03:41:01 +0000 |
commit | 95308d3798637bb4a3542520f71737b4b82d2262 (patch) | |
tree | d9d5d0364dcbab3991211f0808a2fefbfc50eea0 /clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | |
parent | d32ead82d93f38ec11ba78a6c95bc41db377c99e (diff) | |
download | bcm5719-llvm-95308d3798637bb4a3542520f71737b4b82d2262.tar.gz bcm5719-llvm-95308d3798637bb4a3542520f71737b4b82d2262.zip |
[analyzer] Diagnostics: Ensure that the default end of diagnostic path
piece can always be generated.
The default end of diagnostic path piece was failing to generate on a
BlockEdge that was outgoing from a basic block without a terminator,
resulting in a very simple diagnostic being rendered (ex: no path
highlighting or custom visitors). Reuse another function, which is
essentially doing the same thing and correct it not to fail when a block
has no terminator.
llvm-svn: 150659
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index 5ded6bcd568..bc03a2bc30e 100644 --- a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -305,8 +305,9 @@ PathDiagnosticLocation return PathDiagnosticLocation(PS->getStmt(), SM, LC); else if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) { const Stmt *Term = BE->getSrc()->getTerminator(); - assert(Term); - return PathDiagnosticLocation(Term, SM, LC); + if (Term) { + return PathDiagnosticLocation(Term, SM, LC); + } } NI = NI->succ_empty() ? 0 : *(NI->succ_begin()); } |