Summary: -
Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus
Reviewed By: NoQ
Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho,
Szelethus, donat.nagy, dkrupp
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62497
llvm-svn: 362008
const MemRegion *getAsRegion() const;
+ /// printJson - Pretty-prints in JSON format.
+ void printJson(raw_ostream &Out, bool AddQuotes) const;
+
void dumpToStream(raw_ostream &OS) const;
void dump() const;
Indent(Out, InnerSpace, IsDot)
<< "{ \"lctx_id\": " << LC->getID()
<< ", \"stmt_id\": " << S->getID(Ctx) << ", \"pretty\": ";
-
S->printJson(Out, nullptr, PP, /*AddQuotes=*/true);
- Out << ", \"value\": \"" << I->second << "\" }";
+ Out << ", \"value\": ";
+ I->second.printJson(Out, /*AddQuotes=*/true);
+
+ Out << " }";
if (I != LastI)
Out << ',';
#include "clang/AST/DeclCXX.h"
#include "clang/AST/Expr.h"
#include "clang/AST/Type.h"
+#include "clang/Basic/JsonSupport.h"
#include "clang/Basic/LLVM.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
LLVM_DUMP_METHOD void SVal::dump() const { dumpToStream(llvm::errs()); }
+void SVal::printJson(raw_ostream &Out, bool AddQuotes) const {
+ std::string Buf;
+ llvm::raw_string_ostream TempOut(Buf);
+
+ dumpToStream(TempOut);
+
+ Out << JsonFormat(TempOut.str(), AddQuotes);
+}
+
void SVal::dumpToStream(raw_ostream &os) const {
switch (getBaseKind()) {
case UnknownValKind: