[PATCH] D51823: [analyzer] Dump unique identifiers for statements in exploded graph

George Karpenkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 14 19:03:30 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL342310: [analyzer] Dump unique identifiers for statements in exploded graph (authored by george.karpenkov, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51823?vs=164548&id=165626#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51823

Files:
  cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp


Index: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -2974,7 +2974,7 @@
   }
 
   static void dumpProgramPoint(ProgramPoint Loc,
-                               const PrintingPolicy &PP,
+                               const ASTContext &Context,
                                llvm::raw_string_ostream &Out) {
     switch (Loc.getKind()) {
     case ProgramPoint::BlockEntranceKind:
@@ -3019,19 +3019,15 @@
     case ProgramPoint::PreImplicitCallKind: {
       ImplicitCallPoint PC = Loc.castAs<ImplicitCallPoint>();
       Out << "PreCall: ";
-
-      // FIXME: Get proper printing options.
-      PC.getDecl()->print(Out, LangOptions());
+      PC.getDecl()->print(Out, Context.getLangOpts());
       printLocation(Out, PC.getLocation());
       break;
     }
 
     case ProgramPoint::PostImplicitCallKind: {
       ImplicitCallPoint PC = Loc.castAs<ImplicitCallPoint>();
       Out << "PostCall: ";
-
-      // FIXME: Get proper printing options.
-      PC.getDecl()->print(Out, LangOptions());
+      PC.getDecl()->print(Out, Context.getLangOpts());
       printLocation(Out, PC.getLocation());
       break;
     }
@@ -3045,8 +3041,7 @@
       else {
         QualType Ty = Init->getTypeSourceInfo()->getType();
         Ty = Ty.getLocalUnqualifiedType();
-        LangOptions LO; // FIXME.
-        Ty.print(Out, LO);
+        Ty.print(Out, Context.getLangOpts());
       }
       break;
     }
@@ -3060,8 +3055,7 @@
         SourceLocation SLoc = T->getBeginLoc();
 
         Out << "\\|Terminator: ";
-        LangOptions LO; // FIXME.
-        E.getSrc()->printTerminator(Out, LO);
+        E.getSrc()->printTerminator(Out, Context.getLangOpts());
 
         if (SLoc.isFileID()) {
           Out << "\\lline="
@@ -3076,13 +3070,13 @@
           if (Label) {
             if (const auto *C = dyn_cast<CaseStmt>(Label)) {
               Out << "\\lcase ";
-              LangOptions LO; // FIXME.
               if (C->getLHS())
-                C->getLHS()->printPretty(Out, nullptr, PrintingPolicy(LO));
+                C->getLHS()->printPretty(Out, nullptr,
+                                         Context.getPrintingPolicy());
 
               if (const Stmt *RHS = C->getRHS()) {
                 Out << " .. ";
-                RHS->printPretty(Out, nullptr, PrintingPolicy(LO));
+                RHS->printPretty(Out, nullptr, Context.getPrintingPolicy());
               }
 
               Out << ":";
@@ -3112,8 +3106,9 @@
       const Stmt *S = Loc.castAs<StmtPoint>().getStmt();
       assert(S != nullptr && "Expecting non-null Stmt");
 
-      Out << S->getStmtClassName() << ' ' << (const void *)S << ' ';
-      S->printPretty(Out, nullptr, PP);
+      Out << S->getStmtClassName() << ' '
+          << S->getID(Context) << " (" << (const void *)S << ") ";
+      S->printPretty(Out, nullptr, Context.getPrintingPolicy());
       printLocation(Out, S->getBeginLoc());
 
       if (Loc.getAs<PreStmt>())
@@ -3149,12 +3144,12 @@
     }
 
     ProgramStateRef State = N->getState();
-    const auto &PP = State->getStateManager().getContext().getPrintingPolicy();
+    const ASTContext &Context = State->getStateManager().getContext();
 
     // Dump program point for all the previously skipped nodes.
     const ExplodedNode *OtherNode = FirstHiddenNode;
     while (true) {
-      dumpProgramPoint(OtherNode->getLocation(), PP, Out);
+      dumpProgramPoint(OtherNode->getLocation(), Context, Out);
 
       if (const ProgramPointTag *Tag = OtherNode->getLocation().getTag())
         Out << "\\lTag:" << Tag->getTagDescription();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51823.165626.patch
Type: text/x-patch
Size: 3739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180915/582874b6/attachment.bin>


More information about the llvm-commits mailing list