r342316 - [analyzer] Further printing improvements: use declarations,

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 14 19:34:45 PDT 2018


Author: george.karpenkov
Date: Fri Sep 14 19:34:45 2018
New Revision: 342316

URL: http://llvm.org/viewvc/llvm-project?rev=342316&view=rev
Log:
[analyzer] Further printing improvements: use declarations,

skip pointers whenever redundant, use unique prefixes.

Differential Revision: https://reviews.llvm.org/D52114

Modified:
    cfe/trunk/lib/AST/Stmt.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp

Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=342316&r1=342315&r2=342316&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Fri Sep 14 19:34:45 2018
@@ -307,7 +307,6 @@ int64_t Stmt::getID(const ASTContext &Co
   assert(Out && "Wrong allocator used");
   assert(*Out % alignof(Stmt) == 0 && "Wrong alignment information");
   return *Out / alignof(Stmt);
-
 }
 
 CompoundStmt::CompoundStmt(ArrayRef<Stmt *> Stmts, SourceLocation LB,

Modified: cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp?rev=342316&r1=342315&r2=342316&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp Fri Sep 14 19:34:45 2018
@@ -235,8 +235,7 @@ void Environment::print(raw_ostream &Out
       const Stmt *S = I.first.getStmt();
       assert(S != nullptr && "Expected non-null Stmt");
 
-      Out << "(LC " << LC->getID() << " <" << (const void *)LC << ">, S "
-          << S->getID(Context) << " <" << (const void *)S << ">) ";
+      Out << "(LC" << LC->getID() << ", S" << S->getID(Context) << ") ";
       S->printPretty(Out, /*Helper=*/nullptr, PP);
       Out << " : " << I.second << NL;
     }

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=342316&r1=342315&r2=342316&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Fri Sep 14 19:34:45 2018
@@ -3108,16 +3108,16 @@ struct DOTGraphTraits<ExplodedNode*> : p
       const Stmt *S = Loc.castAs<StmtPoint>().getStmt();
       assert(S != nullptr && "Expecting non-null Stmt");
 
-      Out << S->getStmtClassName() << ' '
+      Out << S->getStmtClassName() << " S"
           << S->getID(Context) << " <" << (const void *)S << "> ";
       S->printPretty(Out, /*helper=*/nullptr, Context.getPrintingPolicy(),
                      /*Indentation=*/2, /*NewlineSymbol=*/"\\l");
       printLocation(Out, S->getBeginLoc());
 
       if (Loc.getAs<PreStmt>())
-        Out << "\\lPreStmt\\l;";
+        Out << "\\lPreStmt\\l";
       else if (Loc.getAs<PostLoad>())
-        Out << "\\lPostLoad\\l;";
+        Out << "\\lPostLoad\\l";
       else if (Loc.getAs<PostStore>())
         Out << "\\lPostStore\\l";
       else if (Loc.getAs<PostLValue>())
@@ -3171,9 +3171,8 @@ struct DOTGraphTraits<ExplodedNode*> : p
         static_cast<ExprEngine *>(State->getStateManager().getOwningEngine())
             ->getGraph();
 
-    Out << "StateID: " << State->getID() << " <" << (const void *)State.get()
-        << ">"
-        << " NodeID: " << N->getID(&Graph) << " <" << (const void *)N << ">\\|";
+    Out << "StateID: ST" << State->getID() << ", NodeID: N" << N->getID(&Graph)
+        << " <" << (const void *)N << ">\\|";
 
     bool SameAsAllPredecessors =
         std::all_of(N->pred_begin(), N->pred_end(), [&](const ExplodedNode *P) {

Modified: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp?rev=342316&r1=342315&r2=342316&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp Fri Sep 14 19:34:45 2018
@@ -457,7 +457,7 @@ void MemRegion::dumpToStream(raw_ostream
 }
 
 void AllocaRegion::dumpToStream(raw_ostream &os) const {
-  os << "alloca{" << static_cast<const void *>(Ex) << ',' << Cnt << '}';
+  os << "alloca{S" << Ex->getID(getContext()) << ',' << Cnt << '}';
 }
 
 void FunctionCodeRegion::dumpToStream(raw_ostream &os) const {
@@ -481,12 +481,12 @@ void BlockDataRegion::dumpToStream(raw_o
 
 void CompoundLiteralRegion::dumpToStream(raw_ostream &os) const {
   // FIXME: More elaborate pretty-printing.
-  os << "{ " << static_cast<const void *>(CL) <<  " }";
+  os << "{ S" << CL->getID(getContext()) <<  " }";
 }
 
 void CXXTempObjectRegion::dumpToStream(raw_ostream &os) const {
-  os << "temp_object{" << getValueType().getAsString() << ','
-     << static_cast<const void *>(Ex) << '}';
+  os << "temp_object{" << getValueType().getAsString() << ", "
+     << "S" << Ex->getID(getContext()) << '}';
 }
 
 void CXXBaseObjectRegion::dumpToStream(raw_ostream &os) const {
@@ -535,7 +535,7 @@ void VarRegion::dumpToStream(raw_ostream
   if (const IdentifierInfo *ID = VD->getIdentifier())
     os << ID->getName();
   else
-    os << "VarRegion{" << static_cast<const void *>(this) << '}';
+    os << "VarRegion{D" << VD->getID() << '}';
 }
 
 LLVM_DUMP_METHOD void RegionRawOffset::dump() const {

Modified: cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp?rev=342316&r1=342315&r2=342316&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp Fri Sep 14 19:34:45 2018
@@ -83,7 +83,10 @@ void SymbolCast::dumpToStream(raw_ostrea
 }
 
 void SymbolConjured::dumpToStream(raw_ostream &os) const {
-  os << "conj_$" << getSymbolID() << '{' << T.getAsString() << '}';
+  os << "conj_$" << getSymbolID() << '{' << T.getAsString()
+    << ", LC" << LCtx->getID() << ", S" << S->getID(
+      LCtx->getDecl()->getASTContext()) << ", #" << Count
+    << '}';
 }
 
 void SymbolDerived::dumpToStream(raw_ostream &os) const {




More information about the cfe-commits mailing list