Trivial change to dump() function for SparseBitVector
authorJohn Mosby <ojomojo@gmail.com>
Sat, 22 May 2010 05:13:17 +0000 (05:13 +0000)
committerJohn Mosby <ojomojo@gmail.com>
Sat, 22 May 2010 05:13:17 +0000 (05:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104433 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/SparseBitVector.h

index 6c813ecd36b2449fba09a1c4c878e6e27b845598..0862981887ab186172854519cead93ba808be58e 100644 (file)
@@ -889,13 +889,17 @@ operator-(const SparseBitVector<ElementSize> &LHS,
 // Dump a SparseBitVector to a stream
 template <unsigned ElementSize>
 void dump(const SparseBitVector<ElementSize> &LHS, raw_ostream &out) {
-  out << "[ ";
-
-  typename SparseBitVector<ElementSize>::iterator bi;
-  for (bi = LHS.begin(); bi != LHS.end(); ++bi) {
-    out << *bi << " ";
+  out << "[";
+
+  typename SparseBitVector<ElementSize>::iterator bi = LHS.begin(),
+    be = LHS.end();
+  if (bi != be) {
+    out << *bi;
+    for (++bi; bi != be; ++bi) {
+      out << " " << *bi;
+    }
   }
-  out << " ]\n";
+  out << "]\n";
 }
 } // end namespace llvm