r344944 - [analyzer] Fix dumping for SymbolConjured conjured at no particular statement.
Artem Dergachev via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 22 13:11:10 PDT 2018
Author: dergachev
Date: Mon Oct 22 13:11:10 2018
New Revision: 344944
URL: http://llvm.org/viewvc/llvm-project?rev=344944&view=rev
Log:
[analyzer] Fix dumping for SymbolConjured conjured at no particular statement.
Added:
cfe/trunk/test/Analysis/dump_egraph.cpp
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp?rev=344944&r1=344943&r2=344944&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp Mon Oct 22 13:11:10 2018
@@ -83,10 +83,13 @@ void SymbolCast::dumpToStream(raw_ostrea
}
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 {
Added: cfe/trunk/test/Analysis/dump_egraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dump_egraph.cpp?rev=344944&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/dump_egraph.cpp (added)
+++ cfe/trunk/test/Analysis/dump_egraph.cpp Mon Oct 22 13:11:10 2018
@@ -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\}
More information about the cfe-commits
mailing list