Add a note about a potential PIC optimization.
[oota-llvm.git] / include / llvm / Use.h
index b4d4bda620e8e6de7c4e3bcabc0ad62121f8aa64..0a971d18ce3a31b1478a1bf41e09382a316b82b2 100644 (file)
@@ -17,7 +17,7 @@
 #define LLVM_USE_H
 
 #include "llvm/Support/Casting.h"
-#include "llvm/ADT/iterator"
+#include "llvm/ADT/iterator.h"
 
 namespace llvm {
 
@@ -66,19 +66,22 @@ inline T *transferTag(const T *From, const T *To) {
 // Use is here to make keeping the "use" list of a Value up-to-date really easy.
 //
 class Use {
-public:
+private:
+  /// init - specify Value and User
+  /// @deprecated in 2.4, will be removed soon
   inline void init(Value *V, User *U);
+public:
+  /// swap - provide a fast substitute to std::swap<Use>
+  /// that also works with less standard-compliant compilers
+  void swap(Use &RHS);
 
 private:
-  /// Allow std::swap some intimacy
-  template <typename U> friend void std::swap(U&, U&);
+  /// Copy ctor - do not implement
+  Use(const Use &U);
 
-  /// Copy ctor - Only for std::swap
-  Use(const Use &U) { init(U.get(), 0); }
-
-  /// Destructor - Only for zap() and std::swap
+  /// Destructor - Only for zap()
   inline ~Use() {
-    if (get()) removeFromList();
+    if (Val) removeFromList();
   }
 
   /// Default ctor - This leaves the Use completely uninitialized.  The only thing
@@ -91,8 +94,6 @@ private:
                   , fullStopTag = tagThree };
 
 public:
-
-
   operator Value*() const { return Val; }
   Value *get() const { return Val; }
   User *getUser() const;
@@ -107,7 +108,7 @@ public:
     return RHS;
   }
   const Use &operator=(const Use &RHS) {
-    set(RHS.get());
+    set(RHS.Val);
     return *this;
   }