From e496dcaeef8671b64a9150f0fcb7a390fb5e8e7c Mon Sep 17 00:00:00 2001 From: Csaba Dabis Date: Wed, 12 Jun 2019 18:24:02 +0000 Subject: [PATCH] [analyzer] ProgramPoint: more explicit printJson() Summary: Now we print out every possible kinds of ProgramPoints. Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus Reviewed By: NoQ Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62946 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363187 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ProgramPoint.cpp | 43 +++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/lib/Analysis/ProgramPoint.cpp b/lib/Analysis/ProgramPoint.cpp index 7e05706e48..45f165677f 100644 --- a/lib/Analysis/ProgramPoint.cpp +++ b/lib/Analysis/ProgramPoint.cpp @@ -99,12 +99,6 @@ void ProgramPoint::printJson(llvm::raw_ostream &Out, const char *NL) const { case ProgramPoint::CallExitEndKind: Out << "CallExitEnd\""; break; - case ProgramPoint::PostStmtPurgeDeadSymbolsKind: - Out << "PostStmtPurgeDeadSymbols\""; - break; - case ProgramPoint::PreStmtPurgeDeadSymbolsKind: - Out << "PreStmtPurgeDeadSymbols\""; - break; case ProgramPoint::EpsilonKind: Out << "EpsilonPoint\""; break; @@ -210,20 +204,35 @@ void ProgramPoint::printJson(llvm::raw_ostream &Out, const char *NL) const { Out << ", "; printLocJson(Out, S->getBeginLoc(), SM); - Out << ", \"stmt_point_kind\": "; - if (getAs()) - Out << "\"PreStmt\""; + Out << ", \"stmt_point_kind\": \""; + if (getAs()) + Out << "PreLoad"; + else if (getAs()) + Out << "PreStore"; + else if (getAs()) + Out << "PostAllocatorCall"; + else if (getAs()) + Out << "PostCondition"; else if (getAs()) - Out << "\"PostLoad\""; - else if (getAs()) - Out << "\"PostStore\""; + Out << "PostLoad"; else if (getAs()) - Out << "\"PostLValue\""; - else if (getAs()) - Out << "\"PostAllocatorCall\""; - else - Out << "null"; + Out << "PostLValue"; + else if (getAs()) + Out << "PostStore"; + else if (getAs()) + Out << "PostStmt"; + else if (getAs()) + Out << "PostStmtPurgeDeadSymbols"; + else if (getAs()) + Out << "PreStmtPurgeDeadSymbols"; + else if (getAs()) + Out << "PreStmt"; + else { + Out << "\nKind: '" << getKind(); + llvm_unreachable("' is unhandled StmtPoint kind!"); + } + Out << '\"'; break; } } -- 2.50.1