Add some out-of-line virtual dtors so that the class has a "home", preventing
vtables for (e.g.) Instruction from being emitted into every .o file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28898 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Support/Statistic.cpp b/lib/Support/Statistic.cpp
index f94f246..d771f4d 100644
--- a/lib/Support/Statistic.cpp
+++ b/lib/Support/Statistic.cpp
@@ -61,6 +61,10 @@
static std::vector<StatRecord> *AccumStats = 0;
+// Out of line virtual dtor, to give the vtable etc a home.
+StatisticBase::~StatisticBase() {
+}
+
// Print information when destroyed, iff command line option is specified
void StatisticBase::destroy() const {
if (Enabled && hasSomeData()) {
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index fe4ba50..ab4aaac 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -43,6 +43,12 @@
InsertAtEnd->getInstList().push_back(this);
}
+// Out of line virtual method, so the vtable, etc has a home.
+Instruction::~Instruction() {
+ assert(Parent == 0 && "Instruction still linked in the program!");
+}
+
+
void Instruction::setOpcode(unsigned opc) {
setValueType(Value::InstructionVal + opc);
}
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index ea1008b..c6730e1 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -34,6 +34,8 @@
}
+
+
//===----------------------------------------------------------------------===//
// TerminatorInst Class
//===----------------------------------------------------------------------===//
@@ -48,6 +50,13 @@
: Instruction(Type::VoidTy, iType, Ops, NumOps, "", IAE) {
}
+// 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() {
+}
//===----------------------------------------------------------------------===//
@@ -532,6 +541,10 @@
assert(Ty != Type::VoidTy && "Cannot allocate void!");
}
+// Out of line virtual method, so the vtable, etc has a home.
+AllocationInst::~AllocationInst() {
+}
+
bool AllocationInst::isArrayAllocation() const {
if (ConstantUInt *CUI = dyn_cast<ConstantUInt>(getOperand(0)))
return CUI->getValue() != 1;