summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-03-04 09:19:43 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-03-04 09:19:43 +0000
commit13f0d301e80d5bb43924d049ac7a3f853df20394 (patch)
tree0acfb9476461e687451dd2f6c447ffcd459d39d7 /include
parent775581c4181c7f5ef36258788ae19d6346d3f0ec (diff)
downloadllvm-13f0d301e80d5bb43924d049ac7a3f853df20394.tar.gz
llvm-13f0d301e80d5bb43924d049ac7a3f853df20394.tar.bz2
llvm-13f0d301e80d5bb43924d049ac7a3f853df20394.tar.xz
[cleanup] Add a getOperandNo method to the Use class and implement it
out-of-line so that it can refer to the methods on User. As a consequence, this removes the need to define one template method if value_use_iterator in the extremely strange User.h header (!!!). This makse Use.h slightly less peculiar. The only remaining real peculiarity is the definition of Use::set in Value.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/IR/Use.h8
-rw-r--r--include/llvm/IR/User.h6
2 files changed, 5 insertions, 9 deletions
diff --git a/include/llvm/IR/Use.h b/include/llvm/IR/Use.h
index 62586f5b3d..37967f8c02 100644
--- a/include/llvm/IR/Use.h
+++ b/include/llvm/IR/Use.h
@@ -116,6 +116,9 @@ public:
Use *getNext() const { return Next; }
+ /// \brief Return the operand # of this use in its User.
+ unsigned getOperandNo() const;
+
/// \brief Initializes the waymarking tags on an array of Uses.
///
/// This sets up the array of Uses such that getUser() can find the User from
@@ -208,9 +211,8 @@ public:
Use &getUse() const { return *U; }
/// \brief Return the operand # of this use in its User.
- ///
- /// Defined in User.h
- unsigned getOperandNo() const;
+ /// 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).
diff --git a/include/llvm/IR/User.h b/include/llvm/IR/User.h
index 4f8d1b35df..d288e1908c 100644
--- a/include/llvm/IR/User.h
+++ b/include/llvm/IR/User.h
@@ -206,12 +206,6 @@ template<> struct simplify_type<User::const_op_iterator> {
}
};
-// value_use_iterator::getOperandNo - Requires the definition of the User class.
-template<typename UserTy>
-unsigned value_use_iterator<UserTy>::getOperandNo() const {
- return U - U->getUser()->op_begin();
-}
-
} // End llvm namespace
#endif