aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2008-05-15 01:23:11 +0000
committerNate Begeman <natebegeman@mac.com>2008-05-15 01:23:11 +0000
commitbf36ab92cd3a6919138eb4bb76eff821e926e102 (patch)
tree7a49fb1e31e389335f23855a4cbc510945f9d961 /include
parentfbd40225fa08160f7352aa77682b5b9bfa7c3cab (diff)
downloadexternal_llvm-bf36ab92cd3a6919138eb4bb76eff821e926e102.zip
external_llvm-bf36ab92cd3a6919138eb4bb76eff821e926e102.tar.gz
external_llvm-bf36ab92cd3a6919138eb4bb76eff821e926e102.tar.bz2
Move the operator new and operator delete out of line. This fixes an issue with
operator new() referring to the static initTags function, which has to be in the same linkage unit as any file including User.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51136 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/User.h19
1 files changed, 2 insertions, 17 deletions
diff --git a/include/llvm/User.h b/include/llvm/User.h
index 1454779..44beac2 100644
--- a/include/llvm/User.h
+++ b/include/llvm/User.h
@@ -227,16 +227,7 @@ protected:
///
unsigned NumOperands;
- void *operator new(size_t s, unsigned Us) {
- void *Storage = ::operator new(s + sizeof(Use) * Us);
- Use *Start = static_cast<Use*>(Storage);
- Use *End = Start + Us;
- User *Obj = reinterpret_cast<User*>(End);
- Obj->OperandList = Start;
- Obj->NumOperands = Us;
- Use::initTags(Start, End);
- return Obj;
- }
+ void *operator new(size_t s, unsigned Us);
User(const Type *Ty, unsigned vty, Use *OpList, unsigned NumOps)
: Value(Ty, vty), OperandList(OpList), NumOperands(NumOps) {}
Use *allocHungoffUses(unsigned) const;
@@ -251,13 +242,7 @@ public:
~User() {
Use::zap(OperandList, OperandList + NumOperands);
}
- void operator delete(void *Usr) {
- User *Start = static_cast<User*>(Usr);
- Use *Storage = static_cast<Use*>(Usr) - Start->NumOperands;
- ::operator delete(Storage == Start->OperandList
- ? Storage
- : Usr);
- }
+ void operator delete(void *Usr);
template <unsigned Idx> Use &Op() {
return OperandTraits<User>::op_begin(this)[Idx];
}