r328835 - [analyzer] Better pretty-printing of regions in exploded graph

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 29 15:07:59 PDT 2018


Author: george.karpenkov
Date: Thu Mar 29 15:07:58 2018
New Revision: 328835

URL: http://llvm.org/viewvc/llvm-project?rev=328835&view=rev
Log:
[analyzer] Better pretty-printing of regions in exploded graph

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

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=328835&r1=328834&r2=328835&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Thu Mar 29 15:07:58 2018
@@ -2482,7 +2482,7 @@ void ExprEngine::VisitCommonDeclRefExpr(
     assert(Ex->isGLValue() || VD->getType()->isVoidType());
     const LocationContext *LocCtxt = Pred->getLocationContext();
     const Decl *D = LocCtxt->getDecl();
-    const auto *MD = D ? dyn_cast<CXXMethodDecl>(D) : nullptr;
+    const auto *MD = dyn_cast_or_null<CXXMethodDecl>(D);
     const auto *DeclRefEx = dyn_cast<DeclRefExpr>(Ex);
     Optional<std::pair<SVal, QualType>> VInfo;
 

Modified: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp?rev=328835&r1=328834&r2=328835&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp Thu Mar 29 15:07:58 2018
@@ -430,7 +430,7 @@ void BlockDataRegion::dumpToStream(raw_o
   for (BlockDataRegion::referenced_vars_iterator
          I = referenced_vars_begin(),
          E = referenced_vars_end(); I != E; ++I)
-    os << "(" << I.getCapturedRegion() << "," <<
+    os << "(" << I.getCapturedRegion() << "<-" <<
                  I.getOriginalRegion() << ") ";
   os << '}';
 }
@@ -483,7 +483,12 @@ void SymbolicRegion::dumpToStream(raw_os
 }
 
 void VarRegion::dumpToStream(raw_ostream &os) const {
-  os << *cast<VarDecl>(D);
+  const auto *VD = cast<VarDecl>(D);
+  if (const auto *ID = VD->getIdentifier()) {
+    os << ID->getName();
+  } else {
+    os << "VarRegion{" << static_cast<const void*>(this) << '}';
+  }
 }
 
 LLVM_DUMP_METHOD void RegionRawOffset::dump() const {




More information about the cfe-commits mailing list