[PATCH] D63362: [analyzer] Fix JSON dumps for store clusters.
This revision was automatically updated to reflect the committed changes. Closed by commit rL363896: [analyzer] Fix JSON dumps for store clusters. (authored by dergachev, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D63362?vs=204874=205704#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63362/new/ https://reviews.llvm.org/D63362 Files: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp cfe/trunk/test/Analysis/dump_egraph.cpp cfe/trunk/test/Analysis/expr-inspection.c Index: cfe/trunk/test/Analysis/dump_egraph.cpp === --- cfe/trunk/test/Analysis/dump_egraph.cpp +++ cfe/trunk/test/Analysis/dump_egraph.cpp @@ -22,6 +22,6 @@ // 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\": \"\>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 Index: cfe/trunk/test/Analysis/expr-inspection.c === --- cfe/trunk/test/Analysis/expr-inspection.c +++ cfe/trunk/test/Analysis/expr-inspection.c @@ -25,7 +25,7 @@ // 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: ], Index: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp === --- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -211,7 +211,8 @@ 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 = I.getData(); Index: cfe/trunk/test/Analysis/dump_egraph.cpp === --- cfe/trunk/test/Analysis/dump_egraph.cpp +++ cfe/trunk/test/Analysis/dump_egraph.cpp @@ -22,6 +22,6 @@ // 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\": \"\>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 Index: cfe/trunk/test/Analysis/expr-inspection.c === --- cfe/trunk/test/Analysis/expr-inspection.c +++ cfe/trunk/test/Analysis/expr-inspection.c @@ -25,7 +25,7 @@ // 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: ], Index: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp === --- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -211,7 +211,8 @@ 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 = I.getData();
[PATCH] D63362: [analyzer] Fix JSON dumps for store clusters.
NoQ updated this revision to Diff 204874. NoQ added a comment. Fair enough, they aren't really needed here. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63362/new/ https://reviews.llvm.org/D63362 Files: clang/lib/StaticAnalyzer/Core/RegionStore.cpp clang/test/Analysis/dump_egraph.cpp clang/test/Analysis/expr-inspection.c Index: clang/test/Analysis/expr-inspection.c === --- clang/test/Analysis/expr-inspection.c +++ clang/test/Analysis/expr-inspection.c @@ -25,7 +25,7 @@ // 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: ], Index: clang/test/Analysis/dump_egraph.cpp === --- clang/test/Analysis/dump_egraph.cpp +++ clang/test/Analysis/dump_egraph.cpp @@ -22,6 +22,6 @@ // 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\": \"\>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 Index: clang/lib/StaticAnalyzer/Core/RegionStore.cpp === --- clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -211,7 +211,8 @@ 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 = I.getData(); Index: clang/test/Analysis/expr-inspection.c === --- clang/test/Analysis/expr-inspection.c +++ clang/test/Analysis/expr-inspection.c @@ -25,7 +25,7 @@ // 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: ], Index: clang/test/Analysis/dump_egraph.cpp === --- clang/test/Analysis/dump_egraph.cpp +++ clang/test/Analysis/dump_egraph.cpp @@ -22,6 +22,6 @@ // 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\": \"\>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 Index: clang/lib/StaticAnalyzer/Core/RegionStore.cpp === --- clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -211,7 +211,8 @@ 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 = I.getData(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D63362: [analyzer] Fix JSON dumps for store clusters.
Charusso accepted this revision. Charusso added a comment. This revision is now accepted and ready to land. Thanks you! Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:215 + << "{ \"cluster\": \"" << I.getKey() << "\", \"pointer\": \"" + << ((const void *)I.getKey()) << "\", \"items\": [" << NL; People say extra parens are bad. So as they are the root of the evil, could you remove it, please? (I also like to emphasize same stuff packed into parens for better understanding/readability, but we are the minority.) Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63362/new/ https://reviews.llvm.org/D63362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D63362: [analyzer] Fix JSON dumps for store clusters.
NoQ created this revision. NoQ added a reviewer: Charusso. Herald added subscribers: cfe-commits, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun. Herald added a project: clang. Include a unique pointer so that it was possible to figure out if it's the same cluster in different program states. Repository: rC Clang https://reviews.llvm.org/D63362 Files: clang/lib/StaticAnalyzer/Core/RegionStore.cpp clang/test/Analysis/dump_egraph.cpp clang/test/Analysis/expr-inspection.c Index: clang/test/Analysis/expr-inspection.c === --- clang/test/Analysis/expr-inspection.c +++ clang/test/Analysis/expr-inspection.c @@ -25,7 +25,7 @@ // 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: ], Index: clang/test/Analysis/dump_egraph.cpp === --- clang/test/Analysis/dump_egraph.cpp +++ clang/test/Analysis/dump_egraph.cpp @@ -22,6 +22,6 @@ // 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\": \"\>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 Index: clang/lib/StaticAnalyzer/Core/RegionStore.cpp === --- clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -211,7 +211,8 @@ 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 = I.getData(); Index: clang/test/Analysis/expr-inspection.c === --- clang/test/Analysis/expr-inspection.c +++ clang/test/Analysis/expr-inspection.c @@ -25,7 +25,7 @@ // 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: ], Index: clang/test/Analysis/dump_egraph.cpp === --- clang/test/Analysis/dump_egraph.cpp +++ clang/test/Analysis/dump_egraph.cpp @@ -22,6 +22,6 @@ // 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\": \"\>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 Index: clang/lib/StaticAnalyzer/Core/RegionStore.cpp === --- clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -211,7 +211,8 @@ 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 = I.getData(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits