aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/IR/User.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/IR/User.h')
-rw-r--r--include/llvm/IR/User.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/llvm/IR/User.h b/include/llvm/IR/User.h
index c907d6b670b5..54758a9b6d6a 100644
--- a/include/llvm/IR/User.h
+++ b/include/llvm/IR/User.h
@@ -122,8 +122,16 @@ protected:
}
private:
+ const Use *getHungOffOperands() const {
+ return *(reinterpret_cast<const Use *const *>(this) - 1);
+ }
+
Use *&getHungOffOperands() { return *(reinterpret_cast<Use **>(this) - 1); }
+ const Use *getIntrusiveOperands() const {
+ return reinterpret_cast<const Use *>(this) - NumUserOperands;
+ }
+
Use *getIntrusiveOperands() {
return reinterpret_cast<Use *>(this) - NumUserOperands;
}
@@ -135,11 +143,11 @@ private:
}
public:
- Use *getOperandList() {
+ const Use *getOperandList() const {
return HasHungOffUses ? getHungOffOperands() : getIntrusiveOperands();
}
- const Use *getOperandList() const {
- return const_cast<User *>(this)->getOperandList();
+ Use *getOperandList() {
+ return const_cast<Use *>(static_cast<const User *>(this)->getOperandList());
}
Value *getOperand(unsigned i) const {