diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2019-06-19 23:33:48 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2019-06-19 23:33:48 +0000 |
commit | f9f6cdb1a8d05585256f6f2285aa684e557e5676 (patch) | |
tree | 280c24cf5efd46d1367f614dfe0c278ed51a55fe /clang/lib/Analysis/AnalysisDeclContext.cpp | |
parent | 3bb7b2ec7f7bcb913dc4a44fdbe14af508acefb7 (diff) | |
download | bcm5719-llvm-f9f6cdb1a8d05585256f6f2285aa684e557e5676.tar.gz bcm5719-llvm-f9f6cdb1a8d05585256f6f2285aa684e557e5676.zip |
[analyzer] Fix JSON dumps for location contexts.
Location context ID is a property of the location context, not of an item
within it. It's useful to know the id even when there are no items
in the context, eg. for the purposes of figuring out how did contents
of the Environment for the same location context changed across states.
Differential Revision: https://reviews.llvm.org/D62754
llvm-svn: 363895
Diffstat (limited to 'clang/lib/Analysis/AnalysisDeclContext.cpp')
-rw-r--r-- | clang/lib/Analysis/AnalysisDeclContext.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Analysis/AnalysisDeclContext.cpp b/clang/lib/Analysis/AnalysisDeclContext.cpp index ba1f8375124..28d308132fd 100644 --- a/clang/lib/Analysis/AnalysisDeclContext.cpp +++ b/clang/lib/Analysis/AnalysisDeclContext.cpp @@ -527,7 +527,8 @@ void LocationContext::printJson(raw_ostream &Out, const char *NL, unsigned Frame = 0; for (const LocationContext *LCtx = this; LCtx; LCtx = LCtx->getParent()) { - Indent(Out, Space, IsDot) << "{ \"location_context\": \""; + Indent(Out, Space, IsDot) + << "{ \"lctx_id\": " << LCtx->getID() << ", \"location_context\": \""; switch (LCtx->getKind()) { case StackFrame: Out << '#' << Frame << " Call\", \"calling\": \""; @@ -541,7 +542,7 @@ void LocationContext::printJson(raw_ostream &Out, const char *NL, if (const Stmt *S = cast<StackFrameContext>(LCtx)->getCallSite()) { Out << '\"'; printLocation(Out, SM, S->getBeginLoc()); - Out << '\"'; + Out << '\"'; } else { Out << "null"; } |