[cfe-commits] r170170 - /cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp

Ted Kremenek kremenek at apple.com
Thu Dec 13 17:23:13 PST 2012


Author: kremenek
Date: Thu Dec 13 19:23:13 2012
New Revision: 170170

URL: http://llvm.org/viewvc/llvm-project?rev=170170&view=rev
Log:
Refactor dump methods to make RegionBindingsRef printable in the debugger.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp?rev=170170&r1=170169&r2=170170&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp Thu Dec 13 19:23:13 2012
@@ -201,6 +201,21 @@
   Store asStore() const {
     return asImmutableMap().getRootWithoutRetain();
   }
+
+  void dump(llvm::raw_ostream &OS, const char *nl) const {
+   for (iterator I = begin(), E = end(); I != E; ++I) {
+     const ClusterBindings &Cluster = I.getData();
+     for (ClusterBindings::iterator CI = Cluster.begin(), CE = Cluster.end();
+          CI != CE; ++CI) {
+       OS << ' ' << CI.getKey() << " : " << CI.getData() << nl;
+     }
+     OS << nl;
+   }
+  }
+
+  LLVM_ATTRIBUTE_USED void dump() const {
+    dump(llvm::errs(), "\n");
+  }
 };
 } // end anonymous namespace
 
@@ -2037,13 +2052,5 @@
   OS << "Store (direct and default bindings), "
      << B.asStore()
      << " :" << nl;
-
-  for (RegionBindingsRef::iterator I = B.begin(), E = B.end(); I != E; ++I) {
-    const ClusterBindings &Cluster = I.getData();
-    for (ClusterBindings::iterator CI = Cluster.begin(), CE = Cluster.end();
-         CI != CE; ++CI) {
-      OS << ' ' << CI.getKey() << " : " << CI.getData() << nl;
-    }
-    OS << nl;
-  }
+  B.dump(OS, nl);
 }





More information about the cfe-commits mailing list