aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2019-06-19 23:33:51 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2019-06-19 23:33:51 +0000
commit064c8c689a38bab87c7d8cabe34f4b67ce6b9d35 (patch)
treec7922d02888ecb8cce98689ade50678aef9a1e5d
parentf9f6cdb1a8d05585256f6f2285aa684e557e5676 (diff)
downloadllvm-064c8c689a38bab87c7d8cabe34f4b67ce6b9d35.zip
llvm-064c8c689a38bab87c7d8cabe34f4b67ce6b9d35.tar.gz
llvm-064c8c689a38bab87c7d8cabe34f4b67ce6b9d35.tar.bz2
[analyzer] Fix JSON dumps for store clusters.
Include a unique pointer so that it was possible to figure out if it's the same cluster in different program states. This allows comparing dumps of different states against each other. Differential Revision: https://reviews.llvm.org/D63362 llvm-svn: 363896
-rw-r--r--clang/lib/StaticAnalyzer/Core/RegionStore.cpp3
-rw-r--r--clang/test/Analysis/dump_egraph.cpp2
-rw-r--r--clang/test/Analysis/expr-inspection.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
index 53d0cf54..fa9f751 100644
--- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -211,7 +211,8 @@ public:
unsigned int Space = 0, bool IsDot = false) const {
for (iterator I = begin(); I != end(); ++I) {
Indent(Out, Space, IsDot)
- << "{ \"cluster\": \"" << I.getKey() << "\", \"items\": [" << NL;
+ << "{ \"cluster\": \"" << I.getKey() << "\", \"pointer\": \""
+ << (const void *)I.getKey() << "\", \"items\": [" << NL;
++Space;
const ClusterBindings &CB = I.getData();
diff --git a/clang/test/Analysis/dump_egraph.cpp b/clang/test/Analysis/dump_egraph.cpp
index 3609420..f9ad71b 100644
--- a/clang/test/Analysis/dump_egraph.cpp
+++ b/clang/test/Analysis/dump_egraph.cpp
@@ -22,6 +22,6 @@ void foo() {
// CHECK: \"location_context\": \"#0 Call\", \"calling\": \"T::T\", \"call_line\": \"16\", \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"init_id\": {{[0-9]+}}, \"kind\": \"construct into member variable\", \"argument_index\": null, \"pretty\": \"s\", \"value\": \"&t-\>s\"
-// CHECK: \"cluster\": \"t\", \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"kind\": \"Default\", \"offset\": 0, \"value\": \"conj_$2\{int, LC5, no stmt, #1\}\"
+// CHECK: \"cluster\": \"t\", \"pointer\": \"{{0x[0-9a-f]+}}\", \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"kind\": \"Default\", \"offset\": 0, \"value\": \"conj_$2\{int, LC5, no stmt, #1\}\"
// CHECK: \"dynamic_types\": [\l\{ \"region\": \"HeapSymRegion\{conj_$1\{struct S *, LC1, S{{[0-9]+}}, #1\}\}\", \"dyn_type\": \"struct S\", \"sub_classable\": false\}\l
diff --git a/clang/test/Analysis/expr-inspection.c b/clang/test/Analysis/expr-inspection.c
index 230ee50..841b30a 100644
--- a/clang/test/Analysis/expr-inspection.c
+++ b/clang/test/Analysis/expr-inspection.c
@@ -25,7 +25,7 @@ void foo(int x) {
// CHECK: "program_state": {
// CHECK-NEXT: "store": [
-// CHECK-NEXT: { "cluster": "y", "items": [
+// CHECK-NEXT: { "cluster": "y", "pointer": "{{0x[0-9a-f]+}}", "items": [
// CHECK-NEXT: { "kind": "Direct", "offset": 0, "value": "2 S32b" }
// CHECK-NEXT: ]}
// CHECK-NEXT: ],