[PATCH] D45010: [analyzer] Minor improvements to region printing

George Karpenkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 15:10:49 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL328835: [analyzer] Better pretty-printing of regions in exploded graph (authored by george.karpenkov, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D45010?vs=140173&id=140344#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45010

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


Index: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -430,7 +430,7 @@
   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 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 {
Index: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -2482,7 +2482,7 @@
     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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45010.140344.patch
Type: text/x-patch
Size: 1564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180329/6ad5bd6d/attachment.bin>


More information about the llvm-commits mailing list