]> granicus.if.org Git - clang/commitdiff
[analyzer] Further printing improvements: use declarations,
authorGeorge Karpenkov <ekarpenkov@apple.com>
Sat, 15 Sep 2018 02:34:45 +0000 (02:34 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Sat, 15 Sep 2018 02:34:45 +0000 (02:34 +0000)
skip pointers whenever redundant, use unique prefixes.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342316 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Stmt.cpp
lib/StaticAnalyzer/Core/Environment.cpp
lib/StaticAnalyzer/Core/ExprEngine.cpp
lib/StaticAnalyzer/Core/MemRegion.cpp
lib/StaticAnalyzer/Core/SymbolManager.cpp

index 687b9c24b0939f3c6939e65511894364ade48551..b03b3a6837550a306ef5e622ea25f903bb58e7c1 100644 (file)
@@ -307,7 +307,6 @@ int64_t Stmt::getID(const ASTContext &Context) const {
   assert(Out && "Wrong allocator used");
   assert(*Out % alignof(Stmt) == 0 && "Wrong alignment information");
   return *Out / alignof(Stmt);
-
 }
 
 CompoundStmt::CompoundStmt(ArrayRef<Stmt *> Stmts, SourceLocation LB,
index 4238ceb4ee669d2e9599f8833a3aa5e0e83566c2..c390fe7dc1146e54427591167fa43f466e46e23e 100644 (file)
@@ -235,8 +235,7 @@ void Environment::print(raw_ostream &Out, const char *NL,
       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;
     }
index a0cb43284df5ee52883564efbbc1c0f444a36d24..63a74df49525683b65dd6037e541ea9fe1dda1b0 100644 (file)
@@ -3108,16 +3108,16 @@ struct DOTGraphTraits<ExplodedNode*> : public DefaultDOTGraphTraits {
       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*> : public DefaultDOTGraphTraits {
         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) {
index a3d3eb26615fd0f5ebf287de772fe87b15d5ccee..f262f27d841100d01639821d48b7e5c686fc85fe 100644 (file)
@@ -457,7 +457,7 @@ void MemRegion::dumpToStream(raw_ostream &os) const {
 }
 
 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_ostream &os) const {
 
 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 &os) const {
   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 {
index ed197010ebb7ea66fe43f1182aeefec7261ad544..ec1224e52b928a1835c2aa57accfa0e3bbd00b70 100644 (file)
@@ -83,7 +83,10 @@ void SymbolCast::dumpToStream(raw_ostream &os) const {
 }
 
 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 {