summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/ProgramState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ProgramState.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ProgramState.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp
index 2f5c33ee6c2..a1ca0b1b84b 100644
--- a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp
@@ -10,13 +10,14 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/Analysis/CFG.h"
+#include "clang/Basic/JsonSupport.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeMap.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeMap.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
@@ -441,15 +442,18 @@ void ProgramState::setStore(const StoreRef &newStore) {
//===----------------------------------------------------------------------===//
void ProgramState::printJson(raw_ostream &Out, const LocationContext *LCtx,
- const char *NL, const char *Sep,
- unsigned int Space, bool IsDot) const {
- // Print the store.
+ const char *NL, unsigned int Space,
+ bool IsDot) const {
+ Indent(Out, Space, IsDot) << "\"program_state\": {" << NL;
+ ++Space;
+
ProgramStateManager &Mgr = getStateManager();
- const ASTContext &Context = getStateManager().getContext();
+
+ // Print the store.
Mgr.getStoreManager().printJson(Out, getStore(), NL, Space, IsDot);
// Print out the environment.
- Env.printJson(Out, Context, LCtx, NL, Space, IsDot);
+ Env.printJson(Out, Mgr.getContext(), LCtx, NL, Space, IsDot);
// Print out the constraints.
Mgr.getConstraintManager().printJson(Out, this, NL, Space, IsDot);
@@ -459,11 +463,14 @@ void ProgramState::printJson(raw_ostream &Out, const LocationContext *LCtx,
// Print checker-specific data.
Mgr.getOwningEngine().printJson(Out, this, LCtx, NL, Space, IsDot);
+
+ --Space;
+ Indent(Out, Space, IsDot) << '}';
}
void ProgramState::printDOT(raw_ostream &Out, const LocationContext *LCtx,
unsigned int Space) const {
- printJson(Out, LCtx, "\\l", "\\|", Space, /*IsDot=*/true);
+ printJson(Out, LCtx, /*NL=*/"\\l", Space, /*IsDot=*/true);
}
LLVM_DUMP_METHOD void ProgramState::dump() const {
OpenPOWER on IntegriCloud