Address a memory leak in 254760
[oota-llvm.git] / include / llvm / IR / Use.h
index 37967f8c0232f0b30c24e2116ea220ff2f1bffb5..160d71b03e7ff4d868219e1e65b51dc164c5771f 100644 (file)
@@ -60,7 +60,7 @@ public:
 /// implicit. The implicit pointer is found via a waymarking algorithm
 /// described in the programmer's manual:
 ///
-///   http://www.llvm.org/docs/ProgrammersManual.html#UserLayout
+///   http://www.llvm.org/docs/ProgrammersManual.html#the-waymarking-algorithm
 ///
 /// This is essentially the single most memory intensive object in LLVM because
 /// of the number of uses in the system. At the same time, the constant time
@@ -77,7 +77,7 @@ public:
   typedef PointerIntPair<User *, 1, unsigned> UserRef;
 
 private:
-  Use(const Use &U) LLVM_DELETED_FUNCTION;
+  Use(const Use &U) = delete;
 
   /// Destructor - Only for zap()
   ~Use() {
@@ -88,7 +88,7 @@ private:
   enum PrevPtrTag { zeroDigitTag, oneDigitTag, stopTag, fullStopTag };
 
   /// Constructor
-  Use(PrevPtrTag tag) : Val(0) { Prev.setInt(tag); }
+  Use(PrevPtrTag tag) : Val(nullptr) { Prev.setInt(tag); }
 
 public:
   operator Value *() const { return Val; }
@@ -165,56 +165,6 @@ template <> struct simplify_type<const Use> {
   static SimpleType getSimplifiedValue(const Use &Val) { return Val.get(); }
 };
 
-template<typename UserTy>  // UserTy == 'User' or 'const User'
-class value_use_iterator : public std::iterator<std::forward_iterator_tag,
-                                                UserTy*, ptrdiff_t> {
-  typedef std::iterator<std::forward_iterator_tag, UserTy*, ptrdiff_t> super;
-  typedef value_use_iterator<UserTy> _Self;
-
-  Use *U;
-  explicit value_use_iterator(Use *u) : U(u) {}
-  friend class Value;
-public:
-  typedef typename super::reference reference;
-  typedef typename super::pointer pointer;
-
-  value_use_iterator() {}
-
-  bool operator==(const _Self &x) const {
-    return U == x.U;
-  }
-  bool operator!=(const _Self &x) const {
-    return !operator==(x);
-  }
-
-  /// \brief Returns true if this iterator is equal to use_end() on the value.
-  bool atEnd() const { return U == 0; }
-
-  // Iterator traversal: forward iteration only
-  _Self &operator++() {          // Preincrement
-    assert(U && "Cannot increment end iterator!");
-    U = U->getNext();
-    return *this;
-  }
-  _Self operator++(int) {        // Postincrement
-    _Self tmp = *this; ++*this; return tmp;
-  }
-
-  // Retrieve a pointer to the current User.
-  UserTy *operator*() const {
-    assert(U && "Cannot dereference end iterator!");
-    return U->getUser();
-  }
-
-  UserTy *operator->() const { return operator*(); }
-
-  Use &getUse() const { return *U; }
-
-  /// \brief Return the operand # of this use in its User.
-  /// FIXME: Replace all callers with a direct call to Use::getOperandNo.
-  unsigned getOperandNo() const { return U->getOperandNo(); }
-};
-
 // Create wrappers for C Binding types (see CBindingWrapping.h).
 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Use, LLVMUseRef)