]> granicus.if.org Git - clang/commitdiff
[analyzer] Better pretty-printing of regions in exploded graph
authorGeorge Karpenkov <ekarpenkov@apple.com>
Thu, 29 Mar 2018 22:07:58 +0000 (22:07 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Thu, 29 Mar 2018 22:07:58 +0000 (22:07 +0000)
Differential Revision: https://reviews.llvm.org/D45010

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

lib/StaticAnalyzer/Core/ExprEngine.cpp
lib/StaticAnalyzer/Core/MemRegion.cpp

index d22cf82963b8c7df95397a32e8a3c18f05dc41d4..51c6f25e98c65460fec4eb217ac5646b8d1bd4ef 100644 (file)
@@ -2482,7 +2482,7 @@ void ExprEngine::VisitCommonDeclRefExpr(const Expr *Ex, const NamedDecl *D,
     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;
 
index 1562ff1193f83519dd6fa2dfc41510cca1c0629c..b735f5ab56e26269d46816203215fdcadad9360c 100644 (file)
@@ -430,7 +430,7 @@ void BlockDataRegion::dumpToStream(raw_ostream &os) const {
   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_ostream &os) const {
 }
 
 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 {