]> granicus.if.org Git - clang/commitdiff
[analyzer] ProgramPoint: more explicit printJson()
authorCsaba Dabis <dabis.csaba98@gmail.com>
Wed, 12 Jun 2019 18:24:02 +0000 (18:24 +0000)
committerCsaba Dabis <dabis.csaba98@gmail.com>
Wed, 12 Jun 2019 18:24:02 +0000 (18:24 +0000)
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

index 7e05706e48714afa850e5e0ecea74bb34e99c982..45f165677f99d13d0b03ea213f6a343e1b33e824 100644 (file)
@@ -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<PreStmt>())
-      Out << "\"PreStmt\"";
+    Out << ", \"stmt_point_kind\": \"";
+    if (getAs<PreLoad>())
+      Out << "PreLoad";
+    else if (getAs<PreStore>())
+      Out << "PreStore";
+    else if (getAs<PostAllocatorCall>())
+      Out << "PostAllocatorCall";
+    else if (getAs<PostCondition>())
+      Out << "PostCondition";
     else if (getAs<PostLoad>())
-      Out << "\"PostLoad\"";
-    else if (getAs<PostStore>())
-      Out << "\"PostStore\"";
+      Out << "PostLoad";
     else if (getAs<PostLValue>())
-      Out << "\"PostLValue\"";
-    else if (getAs<PostAllocatorCall>())
-      Out << "\"PostAllocatorCall\"";
-    else
-      Out << "null";
+      Out << "PostLValue";
+    else if (getAs<PostStore>())
+      Out << "PostStore";
+    else if (getAs<PostStmt>())
+      Out << "PostStmt";
+    else if (getAs<PostStmtPurgeDeadSymbols>())
+      Out << "PostStmtPurgeDeadSymbols";
+    else if (getAs<PreStmtPurgeDeadSymbols>())
+      Out << "PreStmtPurgeDeadSymbols";
+    else if (getAs<PreStmt>())
+      Out << "PreStmt";
+    else {
+      Out << "\nKind: '" << getKind();
+      llvm_unreachable("' is unhandled StmtPoint kind!");
+    }
 
+    Out << '\"';
     break;
   }
   }