Skip to content

Commit 064c8c6

Browse files
committed
[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
1 parent f9f6cdb commit 064c8c6

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

clang/lib/StaticAnalyzer/Core/RegionStore.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ class RegionBindingsRef : public llvm::ImmutableMapRef<const MemRegion *,
211211
unsigned int Space = 0, bool IsDot = false) const {
212212
for (iterator I = begin(); I != end(); ++I) {
213213
Indent(Out, Space, IsDot)
214-
<< "{ \"cluster\": \"" << I.getKey() << "\", \"items\": [" << NL;
214+
<< "{ \"cluster\": \"" << I.getKey() << "\", \"pointer\": \""
215+
<< (const void *)I.getKey() << "\", \"items\": [" << NL;
215216

216217
++Space;
217218
const ClusterBindings &CB = I.getData();

clang/test/Analysis/dump_egraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ void foo() {
2222

2323
// 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\"
2424

25-
// 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\}\"
25+
// 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\}\"
2626

2727
// CHECK: \"dynamic_types\": [\l\{ \"region\": \"HeapSymRegion\{conj_$1\{struct S *, LC1, S{{[0-9]+}}, #1\}\}\", \"dyn_type\": \"struct S\", \"sub_classable\": false\}\l

clang/test/Analysis/expr-inspection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void foo(int x) {
2525

2626
// CHECK: "program_state": {
2727
// CHECK-NEXT: "store": [
28-
// CHECK-NEXT: { "cluster": "y", "items": [
28+
// CHECK-NEXT: { "cluster": "y", "pointer": "{{0x[0-9a-f]+}}", "items": [
2929
// CHECK-NEXT: { "kind": "Direct", "offset": 0, "value": "2 S32b" }
3030
// CHECK-NEXT: ]}
3131
// CHECK-NEXT: ],

0 commit comments

Comments
 (0)