From a66b18785d1a55881c214db8b90d60ee348e1e51 Mon Sep 17 00:00:00 2001 From: Artem Dergachev Date: Wed, 19 Jun 2019 23:33:51 +0000 Subject: [PATCH] [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363896 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/StaticAnalyzer/Core/RegionStore.cpp | 3 ++- test/Analysis/dump_egraph.cpp | 2 +- test/Analysis/expr-inspection.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp index 53d0cf54d7..fa9f751c3f 100644 --- a/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/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/test/Analysis/dump_egraph.cpp b/test/Analysis/dump_egraph.cpp index 3609420198..f9ad71b7ab 100644 --- a/test/Analysis/dump_egraph.cpp +++ b/test/Analysis/dump_egraph.cpp @@ -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 diff --git a/test/Analysis/expr-inspection.c b/test/Analysis/expr-inspection.c index 230ee5007c..841b30a9b9 100644 --- a/test/Analysis/expr-inspection.c +++ b/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: ], -- 2.50.1