aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2007-12-10 02:14:30 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2007-12-10 02:14:30 +0000
commitc8ddfa60b8711b95e3c46a73257cab15b3f7bbed (patch)
tree90d674eca01d05d52bdd394518dd2bc76db5c154 /lib/VMCore/Instructions.cpp
parent811c68cf7165252a167727f6e541d315a886bd4e (diff)
downloadexternal_llvm-c8ddfa60b8711b95e3c46a73257cab15b3f7bbed.zip
external_llvm-c8ddfa60b8711b95e3c46a73257cab15b3f7bbed.tar.gz
external_llvm-c8ddfa60b8711b95e3c46a73257cab15b3f7bbed.tar.bz2
Reverting dtor devirtualization patch.
_sabre_: it has a major problem: by the time ~Value is run, all of the "parts" of the derived classes have been destroyed _sabre_: the vtable lives to fight another day git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44760 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp50
1 files changed, 32 insertions, 18 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 84adc50..0df0466 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -67,6 +67,20 @@ bool CallSite::onlyReadsMemory() const {
}
+
+//===----------------------------------------------------------------------===//
+// TerminatorInst Class
+//===----------------------------------------------------------------------===//
+
+// Out of line virtual method, so the vtable, etc has a home.
+TerminatorInst::~TerminatorInst() {
+}
+
+// Out of line virtual method, so the vtable, etc has a home.
+UnaryInstruction::~UnaryInstruction() {
+}
+
+
//===----------------------------------------------------------------------===//
// PHINode Class
//===----------------------------------------------------------------------===//
@@ -82,9 +96,8 @@ PHINode::PHINode(const PHINode &PN)
}
}
-void PHINode::destroyThis(PHINode*v) {
- delete [] v->OperandList;
- Instruction::destroyThis(v);
+PHINode::~PHINode() {
+ delete [] OperandList;
}
// removeIncomingValue - Remove an incoming value. This is useful if a
@@ -201,11 +214,10 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
// CallInst Implementation
//===----------------------------------------------------------------------===//
-void CallInst::destroyThis(CallInst*v) {
- delete [] v->OperandList;
- if (v->ParamAttrs)
- v->ParamAttrs->dropRef();
- Instruction::destroyThis(v);
+CallInst::~CallInst() {
+ delete [] OperandList;
+ if (ParamAttrs)
+ ParamAttrs->dropRef();
}
void CallInst::init(Value *Func, Value* const *Params, unsigned NumParams) {
@@ -394,11 +406,10 @@ bool CallInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
// InvokeInst Implementation
//===----------------------------------------------------------------------===//
-void InvokeInst::destroyThis(InvokeInst*v) {
- delete [] v->OperandList;
- if (v->ParamAttrs)
- v->ParamAttrs->dropRef();
- TerminatorInst::destroyThis(v);
+InvokeInst::~InvokeInst() {
+ delete [] OperandList;
+ if (ParamAttrs)
+ ParamAttrs->dropRef();
}
void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
@@ -672,6 +683,10 @@ AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
setName(Name);
}
+// Out of line virtual method, so the vtable, etc has a home.
+AllocationInst::~AllocationInst() {
+}
+
bool AllocationInst::isArrayAllocation() const {
if (ConstantInt *CI = dyn_cast<ConstantInt>(getOperand(0)))
return CI->getZExtValue() != 1;
@@ -936,8 +951,8 @@ GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
setName(Name);
}
-void GetElementPtrInst::destroyThis(GetElementPtrInst*v) {
- delete[] v->OperandList;
+GetElementPtrInst::~GetElementPtrInst() {
+ delete[] OperandList;
}
// getIndexedType - Returns the type of the element that would be loaded with
@@ -2454,9 +2469,8 @@ SwitchInst::SwitchInst(const SwitchInst &SI)
}
}
-void SwitchInst::destroyThis(SwitchInst*v) {
- delete [] v->OperandList;
- TerminatorInst::destroyThis(v);
+SwitchInst::~SwitchInst() {
+ delete [] OperandList;
}