[analyzer] Fix dumping for SymbolConjured conjured at no particular statement.

llvm-svn: 344944
This commit is contained in:
Artem Dergachev 2018-10-22 20:11:10 +00:00
parent 8eb4fc5c3b
commit 7e4edbdd1b
2 changed files with 22 additions and 4 deletions

View File

@ -83,10 +83,13 @@ void SymbolCast::dumpToStream(raw_ostream &os) const {
}
void SymbolConjured::dumpToStream(raw_ostream &os) const {
os << "conj_$" << getSymbolID() << '{' << T.getAsString()
<< ", LC" << LCtx->getID() << ", S" << S->getID(
LCtx->getDecl()->getASTContext()) << ", #" << Count
<< '}';
os << "conj_$" << getSymbolID() << '{' << T.getAsString() << ", LC"
<< LCtx->getID();
if (S)
os << ", S" << S->getID(LCtx->getDecl()->getASTContext());
else
os << ", no stmt";
os << ", #" << Count << '}';
}
void SymbolDerived::dumpToStream(raw_ostream &os) const {

View File

@ -0,0 +1,15 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-dump-egraph=%t.dot %s
// RUN: cat %t.dot | FileCheck %s
// REQUIRES: asserts
struct S {
~S();
};
void foo() {
// Test that dumping symbols conjured on null statements doesn't crash.
S s;
}
// CHECK: conj_$0\{int, LC1, no stmt, #1\}