r363896 - [analyzer] Fix JSON dumps for store clusters.

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 19 16:33:52 PDT 2019


Author: dergachev
Date: Wed Jun 19 16:33:51 2019
New Revision: 363896

URL: http://llvm.org/viewvc/llvm-project?rev=363896&view=rev
Log:
[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

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
    cfe/trunk/test/Analysis/dump_egraph.cpp
    cfe/trunk/test/Analysis/expr-inspection.c

Modified: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp?rev=363896&r1=363895&r2=363896&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp Wed Jun 19 16:33:51 2019
@@ -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();

Modified: cfe/trunk/test/Analysis/dump_egraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dump_egraph.cpp?rev=363896&r1=363895&r2=363896&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/dump_egraph.cpp (original)
+++ cfe/trunk/test/Analysis/dump_egraph.cpp Wed Jun 19 16:33:51 2019
@@ -22,6 +22,6 @@ void foo() {
 
 // CHECK: \"location_context\": \"#0 Call\", \"calling\": \"T::T\", \"call_line\": \"16\", \"items\": [\l        \{ \"init_id\": {{[0-9]+}}, \"kind\": \"construct into member variable\", \"argument_index\": null, \"pretty\": \"s\", \"value\": \"&t-\>s\"
 
-// CHECK: \"cluster\": \"t\", \"items\": [\l        \{ \"kind\": \"Default\", \"offset\": 0, \"value\": \"conj_$2\{int, LC5, no stmt, #1\}\"
+// CHECK: \"cluster\": \"t\", \"pointer\": \"{{0x[0-9a-f]+}}\", \"items\": [\l        \{ \"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

Modified: cfe/trunk/test/Analysis/expr-inspection.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/expr-inspection.c?rev=363896&r1=363895&r2=363896&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/expr-inspection.c (original)
+++ cfe/trunk/test/Analysis/expr-inspection.c Wed Jun 19 16:33:51 2019
@@ -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:   ],




More information about the cfe-commits mailing list