r363187 - [analyzer] ProgramPoint: more explicit printJson()

Csaba Dabis via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 11:24:02 PDT 2019


Author: charusso
Date: Wed Jun 12 11:24:02 2019
New Revision: 363187

URL: http://llvm.org/viewvc/llvm-project?rev=363187&view=rev
Log:
[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

Modified:
    cfe/trunk/lib/Analysis/ProgramPoint.cpp

Modified: cfe/trunk/lib/Analysis/ProgramPoint.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ProgramPoint.cpp?rev=363187&r1=363186&r2=363187&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ProgramPoint.cpp (original)
+++ cfe/trunk/lib/Analysis/ProgramPoint.cpp Wed Jun 12 11:24:02 2019
@@ -99,12 +99,6 @@ void ProgramPoint::printJson(llvm::raw_o
   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_o
     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;
   }
   }




More information about the cfe-commits mailing list