diff options
| author | Artem Dergachev <artem.dergachev@gmail.com> | 2019-06-19 23:33:55 +0000 |
|---|---|---|
| committer | Artem Dergachev <artem.dergachev@gmail.com> | 2019-06-19 23:33:55 +0000 |
| commit | b50d1673581a4f8dd33c36eb5a9964ad5fe4b2c4 (patch) | |
| tree | f49b52e3252413b30766de97e73babcb33f6e2f2 /clang/lib/StaticAnalyzer/Core/RegionStore.cpp | |
| parent | 064c8c689a38bab87c7d8cabe34f4b67ce6b9d35 (diff) | |
| download | bcm5719-llvm-b50d1673581a4f8dd33c36eb5a9964ad5fe4b2c4.tar.gz bcm5719-llvm-b50d1673581a4f8dd33c36eb5a9964ad5fe4b2c4.zip | |
[analyzer] exploded-graph-rewriter: Fix escaping StringRegions.
Quotes around StringRegions are now escaped and unescaped correctly,
producing valid JSON.
Additionally, add a forgotten escape for Store values.
Differential Revision: https://reviews.llvm.org/D63519
llvm-svn: 363897
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/RegionStore.cpp')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/RegionStore.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp index fa9f751c3f7..9bc0e62c27f 100644 --- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -210,6 +210,7 @@ public: void printJson(raw_ostream &Out, const char *NL = "\n", unsigned int Space = 0, bool IsDot = false) const { for (iterator I = begin(); I != end(); ++I) { + // TODO: We might need a .printJson for I.getKey() as well. Indent(Out, Space, IsDot) << "{ \"cluster\": \"" << I.getKey() << "\", \"pointer\": \"" << (const void *)I.getKey() << "\", \"items\": [" << NL; @@ -217,8 +218,9 @@ public: ++Space; const ClusterBindings &CB = I.getData(); for (ClusterBindings::iterator CI = CB.begin(); CI != CB.end(); ++CI) { - Indent(Out, Space, IsDot) << "{ " << CI.getKey() << ", \"value\": \"" - << CI.getData() << "\" }"; + Indent(Out, Space, IsDot) << "{ " << CI.getKey() << ", \"value\": "; + CI.getData().printJson(Out, /*AddQuotes=*/true); + Out << " }"; if (std::next(CI) != CB.end()) Out << ','; Out << NL; |

