Remove bogus assertion. This unbreaks mingw, where ConstantSDNode
[oota-llvm.git] / include / llvm / ADT / ilist.h
index d4bcb5b9040fd6d6057ceef4901347d87732a967..41253e030c5ffcba5ae1eaaa2a850b89a83ed966 100644 (file)
@@ -35,8 +35,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_ADT_ILIST
-#define LLVM_ADT_ILIST
+#ifndef LLVM_ADT_ILIST_H
+#define LLVM_ADT_ILIST_H
 
 #include "llvm/ADT/iterator.h"
 #include <cassert>
@@ -60,6 +60,7 @@ struct ilist_traits {
   static void setNext(NodeTy *N, NodeTy *Next) { N->setNext(Next); }
 
   static NodeTy *createNode(const NodeTy &V) { return new NodeTy(V); }
+  static void deleteNode(NodeTy *V) { delete V; }
 
   static NodeTy *createSentinel() { return new NodeTy(); }
   static void destroySentinel(NodeTy *N) { delete N; }
@@ -82,15 +83,20 @@ struct ilist_traits<const Ty> : public ilist_traits<Ty> {};
 template<typename NodeTy>
 class ilist_iterator
   : public bidirectional_iterator<NodeTy, ptrdiff_t> {
+    
+public:
   typedef ilist_traits<NodeTy> Traits;
   typedef bidirectional_iterator<NodeTy, ptrdiff_t> super;
 
-public:
   typedef size_t size_type;
   typedef typename super::pointer pointer;
   typedef typename super::reference reference;
 private:
   pointer NodePtr;
+
+  // operator[] is not defined. Compile error instead of having a runtime bug.
+  void operator[](unsigned) {}
+  void operator[](unsigned) const {}
 public:
 
   ilist_iterator(pointer NP) : NodePtr(NP) {}
@@ -121,8 +127,7 @@ public:
     assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!");
     return *NodePtr;
   }
-  pointer operator->() { return &operator*(); }
-  const pointer operator->() const { return &operator*(); }
+  pointer operator->() const { return &operator*(); }
 
   // Comparison operators
   bool operator==(const ilist_iterator &RHS) const {
@@ -256,6 +261,12 @@ class iplist : public Traits {
 
   static bool op_less(NodeTy &L, NodeTy &R) { return L < R; }
   static bool op_equal(NodeTy &L, NodeTy &R) { return L == R; }
+
+  // No fundamental reason why iplist can't by copyable, but the default
+  // copy/copy-assign won't do.
+  iplist(const iplist &);         // do not implement
+  void operator=(const iplist &); // do not implement
+
 public:
   typedef NodeTy *pointer;
   typedef const NodeTy *const_pointer;
@@ -374,7 +385,7 @@ public:
 
   // erase - remove a node from the controlled sequence... and delete it.
   iterator erase(iterator where) {
-    delete remove(where);
+    deleteNode(remove(where));
     return where;
   }
 
@@ -631,4 +642,4 @@ namespace std {
   }
 }  // End 'std' extensions...
 
-#endif
+#endif // LLVM_ADT_ILIST_H