X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FUse.h;h=0a971d18ce3a31b1478a1bf41e09382a316b82b2;hb=56867520990a4fea1353d55f71bb74a0126554e6;hp=b4d4bda620e8e6de7c4e3bcabc0ad62121f8aa64;hpb=efe65369a74871c3140a540a6c95ce5d1f080954;p=oota-llvm.git diff --git a/include/llvm/Use.h b/include/llvm/Use.h index b4d4bda620e..0a971d18ce3 100644 --- a/include/llvm/Use.h +++ b/include/llvm/Use.h @@ -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 + /// that also works with less standard-compliant compilers + void swap(Use &RHS); private: - /// Allow std::swap some intimacy - template 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; }