summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/Environment.cpp
diff options
context:
space:
mode:
authorCsaba Dabis <dabis.csaba98@gmail.com>2019-05-29 18:17:18 +0000
committerCsaba Dabis <dabis.csaba98@gmail.com>2019-05-29 18:17:18 +0000
commit9ee26c8d5f049f0f5fc99944a75e4900d4ae3110 (patch)
tree68704c4dc235dc3d494aa74c157507fb115c56d0 /clang/lib/StaticAnalyzer/Core/Environment.cpp
parent03e1a82f52d219225c22f14ac73966bb97d4fd0d (diff)
downloadbcm5719-llvm-9ee26c8d5f049f0f5fc99944a75e4900d4ae3110.tar.gz
bcm5719-llvm-9ee26c8d5f049f0f5fc99944a75e4900d4ae3110.zip
[analyzer][AST] print() JSONify: Stmt implementation
Summary: This patch also adds a function called `JsonFormat()` which: - Flattens the string so removes the new-lines. - Escapes double quotes. Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus Reviewed By: NoQ Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D62494 llvm-svn: 362000
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/Environment.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/Environment.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/Environment.cpp b/clang/lib/StaticAnalyzer/Core/Environment.cpp
index 6344bc5a4d6..df2402ba017 100644
--- a/clang/lib/StaticAnalyzer/Core/Environment.cpp
+++ b/clang/lib/StaticAnalyzer/Core/Environment.cpp
@@ -235,9 +235,6 @@ void Environment::printJson(raw_ostream &Out, const ASTContext &Ctx,
bool HasItem = false;
unsigned int InnerSpace = Space + 1;
- llvm::SmallString<256> TempBuf;
- llvm::raw_svector_ostream TempOut(TempBuf);
-
// Store the last ExprBinding which we will print.
BindingsTy::iterator LastI = ExprBindings.end();
for (BindingsTy::iterator I = ExprBindings.begin(); I != ExprBindings.end();
@@ -266,14 +263,7 @@ void Environment::printJson(raw_ostream &Out, const ASTContext &Ctx,
<< "{ \"lctx_id\": " << LC->getID()
<< ", \"stmt_id\": " << S->getID(Ctx) << ", \"pretty\": ";
- // See whether the current statement is pretty-printable.
- S->printPretty(TempOut, /*Helper=*/nullptr, PP);
- if (!TempBuf.empty()) {
- Out << '\"' << TempBuf.str().trim() << '\"';
- TempBuf.clear();
- } else {
- Out << "null";
- }
+ S->printJson(Out, nullptr, PP, /*AddQuotes=*/true);
Out << ", \"value\": \"" << I->second << "\" }";
OpenPOWER on IntegriCloud