summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-10-22 20:11:10 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-10-22 20:11:10 +0000
commit7e4edbdd1b4d2fa97478fc16be2efff4de9afdf9 (patch)
tree058bf835c9053930ff77338364712146cf321319
parent8eb4fc5c3be0545b5cc0aa75bad864e49c42f022 (diff)
downloadbcm5719-llvm-7e4edbdd1b4d2fa97478fc16be2efff4de9afdf9.tar.gz
bcm5719-llvm-7e4edbdd1b4d2fa97478fc16be2efff4de9afdf9.zip
[analyzer] Fix dumping for SymbolConjured conjured at no particular statement.
llvm-svn: 344944
-rw-r--r--clang/lib/StaticAnalyzer/Core/SymbolManager.cpp11
-rw-r--r--clang/test/Analysis/dump_egraph.cpp15
2 files changed, 22 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/SymbolManager.cpp b/clang/lib/StaticAnalyzer/Core/SymbolManager.cpp
index ec1224e52b9..4129191dd82 100644
--- a/clang/lib/StaticAnalyzer/Core/SymbolManager.cpp
+++ b/clang/lib/StaticAnalyzer/Core/SymbolManager.cpp
@@ -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 {
diff --git a/clang/test/Analysis/dump_egraph.cpp b/clang/test/Analysis/dump_egraph.cpp
new file mode 100644
index 00000000000..74133c54014
--- /dev/null
+++ b/clang/test/Analysis/dump_egraph.cpp
@@ -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\}
OpenPOWER on IntegriCloud