From 3422cf05a8a4817c6c525ef4d66026761ec590c1 Mon Sep 17 00:00:00 2001 From: John Mosby Date: Sat, 22 May 2010 05:13:17 +0000 Subject: [PATCH] Trivial change to dump() function for SparseBitVector git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104433 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/SparseBitVector.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/include/llvm/ADT/SparseBitVector.h b/include/llvm/ADT/SparseBitVector.h index 6c813ecd36b..0862981887a 100644 --- a/include/llvm/ADT/SparseBitVector.h +++ b/include/llvm/ADT/SparseBitVector.h @@ -889,13 +889,17 @@ operator-(const SparseBitVector &LHS, // Dump a SparseBitVector to a stream template void dump(const SparseBitVector &LHS, raw_ostream &out) { - out << "[ "; + out << "["; - typename SparseBitVector::iterator bi; - for (bi = LHS.begin(); bi != LHS.end(); ++bi) { - out << *bi << " "; + typename SparseBitVector::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