summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorCsaba Dabis <dabis.csaba98@gmail.com>2019-06-25 03:17:55 +0000
committerCsaba Dabis <dabis.csaba98@gmail.com>2019-06-25 03:17:55 +0000
commit0cdd13c05a16c90aa4dde56e1e46ca7e0a7261d6 (patch)
tree816823d2e1591fc2e58f4ff6ee573cc14f4d08ff /clang/lib
parentc55170c0310961b64a7fe89824114ebb78315c72 (diff)
downloadbcm5719-llvm-0cdd13c05a16c90aa4dde56e1e46ca7e0a7261d6.tar.gz
bcm5719-llvm-0cdd13c05a16c90aa4dde56e1e46ca7e0a7261d6.zip
[analyzer] print() JSONify: Create pointers
Summary: - Reviewers: NoQ Reviewed By: NoQ Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63726 llvm-svn: 364271
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/StaticAnalyzer/Core/Environment.cpp7
-rw-r--r--clang/lib/StaticAnalyzer/Core/RegionStore.cpp6
2 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/Environment.cpp b/clang/lib/StaticAnalyzer/Core/Environment.cpp
index 0ca3f778f1b..551c89b04db 100644
--- a/clang/lib/StaticAnalyzer/Core/Environment.cpp
+++ b/clang/lib/StaticAnalyzer/Core/Environment.cpp
@@ -204,13 +204,13 @@ void Environment::printJson(raw_ostream &Out, const ASTContext &Ctx,
const LocationContext *LCtx, const char *NL,
unsigned int Space, bool IsDot) const {
Indent(Out, Space, IsDot) << "\"environment\": ";
- ++Space;
if (ExprBindings.isEmpty()) {
Out << "null," << NL;
return;
}
+ ++Space;
if (!LCtx) {
// Find the freshest location context.
llvm::SmallPtrSet<const LocationContext *, 16> FoundContexts;
@@ -227,7 +227,8 @@ void Environment::printJson(raw_ostream &Out, const ASTContext &Ctx,
assert(LCtx);
- Out << '[' << NL; // Start of Environment.
+ Out << "{ \"pointer\": \"" << (const void *)LCtx->getStackFrame()
+ << "\", \"items\": [" << NL;
PrintingPolicy PP = Ctx.getPrintingPolicy();
LCtx->printJson(Out, NL, Space, IsDot, [&](const LocationContext *LC) {
@@ -280,5 +281,5 @@ void Environment::printJson(raw_ostream &Out, const ASTContext &Ctx,
Out << "null ";
});
- Indent(Out, --Space, IsDot) << "]," << NL; // End of Environment.
+ Indent(Out, --Space, IsDot) << "]}," << NL;
}
diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
index 9bc0e62c27f..a389619f842 100644
--- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -2640,7 +2640,7 @@ void RegionStoreManager::printJson(raw_ostream &Out, Store S, const char *NL,
return;
}
- Out << '[' << NL;
- Bindings.printJson(Out, NL, ++Space, IsDot);
- Indent(Out, --Space, IsDot) << "]," << NL;
+ Out << "{ \"pointer\": \"" << Bindings.asStore() << "\", \"items\": [" << NL;
+ Bindings.printJson(Out, NL, Space + 1, IsDot);
+ Indent(Out, Space, IsDot) << "]}," << NL;
}
OpenPOWER on IntegriCloud