[PATCH] D62946: [analyzer] ProgramPoint: more explicit printJson()

Csaba Dabis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 04:17:08 PDT 2019


Charusso created this revision.
Charusso added reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus.
Charusso added a project: clang.
Herald added subscribers: cfe-commits, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet.

Now we print out every possible kinds of ProgramPoints.


Repository:
  rC Clang

https://reviews.llvm.org/D62946

Files:
  clang/lib/Analysis/ProgramPoint.cpp


Index: clang/lib/Analysis/ProgramPoint.cpp
===================================================================
--- clang/lib/Analysis/ProgramPoint.cpp
+++ clang/lib/Analysis/ProgramPoint.cpp
@@ -99,12 +99,6 @@
   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 @@
     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;
   }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62946.203328.patch
Type: text/x-patch
Size: 1937 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190606/ff81e961/attachment.bin>


More information about the cfe-commits mailing list