summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2019-06-19 23:33:45 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2019-06-19 23:33:45 +0000
commit3bb7b2ec7f7bcb913dc4a44fdbe14af508acefb7 (patch)
tree6e945b9195f714d8cad28ae0d3f86e23681bed29
parent44820630dfa45bc47748a5abda7d4a9cb86da2c1 (diff)
downloadbcm5719-llvm-3bb7b2ec7f7bcb913dc4a44fdbe14af508acefb7.tar.gz
bcm5719-llvm-3bb7b2ec7f7bcb913dc4a44fdbe14af508acefb7.zip
[analyzer] Fix JSON dumps for dynamic type information.
They're now valid JSON. Differential Revision: https://reviews.llvm.org/D62716 llvm-svn: 363894
-rw-r--r--clang/lib/StaticAnalyzer/Core/DynamicTypeMap.cpp4
-rw-r--r--clang/test/Analysis/dump_egraph.cpp5
2 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/DynamicTypeMap.cpp b/clang/lib/StaticAnalyzer/Core/DynamicTypeMap.cpp
index 22c4cc4a624..75ae2606910 100644
--- a/clang/lib/StaticAnalyzer/Core/DynamicTypeMap.cpp
+++ b/clang/lib/StaticAnalyzer/Core/DynamicTypeMap.cpp
@@ -72,12 +72,12 @@ void printDynamicTypeInfoJson(raw_ostream &Out, ProgramStateRef State,
Out << "{ \"region\": \"" << MR << "\", \"dyn_type\": ";
if (DTI.isValid()) {
Out << '\"' << DTI.getType()->getPointeeType().getAsString()
- << "\" \"sub_classable\": "
+ << "\", \"sub_classable\": "
<< (DTI.canBeASubClass() ? "true" : "false");
} else {
Out << "null"; // Invalid type info
}
- Out << "\" }";
+ Out << "}";
if (std::next(I) != DTM.end())
Out << ',';
diff --git a/clang/test/Analysis/dump_egraph.cpp b/clang/test/Analysis/dump_egraph.cpp
index c62e4bfd4c1..d74009589f0 100644
--- a/clang/test/Analysis/dump_egraph.cpp
+++ b/clang/test/Analysis/dump_egraph.cpp
@@ -14,11 +14,14 @@ struct T {
void foo() {
// Test that dumping symbols conjured on null statements doesn't crash.
T t;
+
+ new S;
}
// CHECK: \"location_context\": \"#0 Call\", \"calling\": \"foo\", \"call_line\": null, \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"lctx_id\": 1, \"stmt_id\": {{[0-9]+}}, \"kind\": \"construct into local variable\", \"argument_index\": null, \"pretty\": \"T t;\", \"value\": \"&t\"
// CHECK: \"location_context\": \"#0 Call\", \"calling\": \"T::T\", \"call_line\": \"16\", \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"lctx_id\": 2, \"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_$3\{int, LC3, no stmt, #1\}\"
+// 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: \"dynamic_types\": [\l\{ \"region\": \"HeapSymRegion\{conj_$1\{struct S *, LC1, S{{[0-9]+}}, #1\}\}\", \"dyn_type\": \"struct S\", \"sub_classable\": false\}\l
OpenPOWER on IntegriCloud