summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2008-05-13 22:51:52 +0000
committerGabor Greif <ggreif@gmail.com>2008-05-13 22:51:52 +0000
commit94fb68ba217975d2d99ae86d15993402158ac655 (patch)
tree552de423a4b79ff2cf57b7c68f5e2db81fb562d2 /include
parente3fc3858a2e9d6483a68a6696d07f29ccc799cce (diff)
downloadllvm-94fb68ba217975d2d99ae86d15993402158ac655.tar.gz
llvm-94fb68ba217975d2d99ae86d15993402158ac655.tar.bz2
llvm-94fb68ba217975d2d99ae86d15993402158ac655.tar.xz
Merge of r51073-51074 from use-diet branch.
Do not rely on std::swap<Use>, provide a (faster) member function instead. This change is primarily necessitated by MSVC++'s incompatibility with declaring std::swap<Use> to be a friend of Use. Also contains some minor tweaks to Use inline functions, to undo pointless changes that sneaked in with the last merge. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51078 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Instructions.h4
-rw-r--r--include/llvm/Use.h18
2 files changed, 12 insertions, 10 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 3b3aecf816..4808e11eb4 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -760,7 +760,7 @@ public:
/// @brief Swap operands and adjust predicate.
void swapOperands() {
SubclassData = getSwappedPredicate();
- std::swap(Op<0>(), Op<1>());
+ Op<0>().swap(Op<1>());
}
virtual ICmpInst *clone() const;
@@ -879,7 +879,7 @@ public:
/// @brief Swap operands and adjust predicate.
void swapOperands() {
SubclassData = getSwappedPredicate();
- std::swap(Op<0>(), Op<1>());
+ Op<0>().swap(Op<1>());
}
virtual FCmpInst *clone() const;
diff --git a/include/llvm/Use.h b/include/llvm/Use.h
index b4d4bda620..79bcdd177b 100644
--- a/include/llvm/Use.h
+++ b/include/llvm/Use.h
@@ -67,18 +67,20 @@ inline T *transferTag(const T *From, const T *To) {
//
class Use {
public:
+ /// init - specify Value and User
+ /// @deprecated in 2.4, will be removed soon
inline void init(Value *V, User *U);
+ /// 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
@@ -107,7 +109,7 @@ public:
return RHS;
}
const Use &operator=(const Use &RHS) {
- set(RHS.get());
+ set(RHS.Val);
return *this;
}