[llvm-commits] [poolalloc] r104240 - /poolalloc/trunk/lib/DSA/Printer.cpp

John Criswell criswell at uiuc.edu
Thu May 20 10:56:31 PDT 2010


Author: criswell
Date: Thu May 20 12:56:31 2010
New Revision: 104240

URL: http://llvm.org/viewvc/llvm-project?rev=104240&view=rev
Log:
Fix the printing of DSGraphs.  The previous code doesn't handle DSNodes of size
zero correctly.

Modified:
    poolalloc/trunk/lib/DSA/Printer.cpp

Modified: poolalloc/trunk/lib/DSA/Printer.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Printer.cpp?rev=104240&r1=104239&r2=104240&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Printer.cpp (original)
+++ poolalloc/trunk/lib/DSA/Printer.cpp Thu May 20 12:56:31 2010
@@ -145,8 +145,16 @@
 
   static bool edgeTargetsEdgeSource(const void *Node,
                                     DSNode::const_iterator I) {
-    unsigned O = I->getLink(I.getOffset()).getOffset();
-    return O != 0;
+    if (I.getOffset() < I->getSize()) {
+      if (I->hasLink (I.getOffset())) {
+        unsigned O = I->getLink(I.getOffset()).getOffset();
+        return O != 0;
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
   }
 
   static std::string getEdgeSourceLabel(const void* Node,





More information about the llvm-commits mailing list