Refactor some functionality to expose more useful stuff
authorChris Lattner <sabre@nondot.org>
Sat, 10 Nov 2001 06:47:45 +0000 (06:47 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 10 Nov 2001 06:47:45 +0000 (06:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1240 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ValueHolder.h

index 77bae5d68291a10222be412011f865b38a0aac92..ef4ed1949f8f3a6f2e123a1b99704c08cb7a70e2 100644 (file)
@@ -81,13 +81,6 @@ public:
   inline reverse_iterator       rend  ()       { return ValueList.rend();   }
   inline const_reverse_iterator rend  () const { return ValueList.rend();   }
   
-  void delete_all() {            // Delete all removes and deletes all elements
-    while (!empty()) {
-      iterator it = end();
-      delete remove(--it);          // Delete all instructions...
-    }
-  }
-
   // ValueHolder::remove(iterator &) this removes the element at the location 
   // specified by the iterator, and leaves the iterator pointing to the element 
   // that used to follow the element deleted.
@@ -97,6 +90,19 @@ public:
   void           remove(ValueSubclass *D);     // Defined in ValueHolderImpl.h
   ValueSubclass *pop_back();                   // Defined in ValueHolderImpl.h
 
+  // delete_span - Remove the elements from begin to end, deleting them as we
+  // go.  This leaves the iterator pointing to the element that used to be end.
+  //
+  iterator delete_span(iterator begin, iterator end) {
+    while (end != begin)
+      delete remove(--end);
+    return end;
+  }
+
+  void delete_all() {            // Delete all removes and deletes all elements
+    delete_span(begin(), end());
+  }
+
   void push_front(ValueSubclass *Inst);        // Defined in ValueHolderImpl.h
   void push_back(ValueSubclass *Inst);         // Defined in ValueHolderImpl.h