[PATCH] D40793: [analyzer] Improve SymbolicRegion::dump() for heap pointers.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 10:34:07 PST 2017


NoQ created this revision.
Herald added subscribers: cfe-commits, rnkovacs.

Because for every symbol `$x` we can construct exactly two different `MemRegion`s that both get dumped as `SymRegion{$x}`, and i didn't bother fixing it for years, i wanted to at least make the problem apparent. With this patch, the unknown-memory-spaced symbolic region remains `SymRegion{$x}`, while the heap-based memory region is dumped as `HeapSymRegion{$x}`.

Does anybody want me to add tests for this debug print?


Repository:
  rC Clang

https://reviews.llvm.org/D40793

Files:
  lib/StaticAnalyzer/Core/MemRegion.cpp


Index: lib/StaticAnalyzer/Core/MemRegion.cpp
===================================================================
--- lib/StaticAnalyzer/Core/MemRegion.cpp
+++ lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -472,6 +472,8 @@
 }
 
 void SymbolicRegion::dumpToStream(raw_ostream &os) const {
+  if (isa<HeapSpaceRegion>(getSuperRegion()))
+    os << "Heap";
   os << "SymRegion{" << sym << '}';
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40793.125367.patch
Type: text/x-patch
Size: 390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171204/86464c4c/attachment.bin>


More information about the cfe-commits mailing list