[analyzer] Fix JSON dumps for store clusters.
authorArtem Dergachev <artem.dergachev@gmail.com>
Wed, 19 Jun 2019 23:33:51 +0000 (23:33 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Wed, 19 Jun 2019 23:33:51 +0000 (23:33 +0000)
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

clang/lib/StaticAnalyzer/Core/RegionStore.cpp
clang/test/Analysis/dump_egraph.cpp
clang/test/Analysis/expr-inspection.c

index 53d0cf54d703f1ab73cd49101f70ecd23a87c07b..fa9f751c3f74f1dca4ea9b7f337496fce214affa 100644 (file)
@@ -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();
index 3609420198f74e99d79126615f357faff12b4f9b..f9ad71b7abcb7231623cfb7677dfd3387a7c8be0 100644 (file)
@@ -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
index 230ee5007c0e2330b09bef48dacb6b14063abf63..841b30a9b99d7ab8208133f8d6e08ade1d15f44d 100644 (file)
@@ -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:   ],