[llvm-commits] CVS: llvm/include/llvm/InstrTypes.h Instruction.h Instructions.h
Chris Lattner
lattner at cs.uiuc.edu
Wed Jun 21 09:54:01 PDT 2006
Changes in directory llvm/include/llvm:
InstrTypes.h updated: 1.45 -> 1.46
Instruction.h updated: 1.71 -> 1.72
Instructions.h updated: 1.36 -> 1.37
---
Log message:
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.
---
Diffs of the changes: (+11 -7)
InstrTypes.h | 5 +++++
Instruction.h | 8 +++-----
Instructions.h | 5 +++--
3 files changed, 11 insertions(+), 7 deletions(-)
Index: llvm/include/llvm/InstrTypes.h
diff -u llvm/include/llvm/InstrTypes.h:1.45 llvm/include/llvm/InstrTypes.h:1.46
--- llvm/include/llvm/InstrTypes.h:1.45 Sun Apr 24 02:28:04 2005
+++ llvm/include/llvm/InstrTypes.h Wed Jun 21 11:53:47 2006
@@ -43,6 +43,9 @@
const std::string &Name, BasicBlock *InsertAtEnd)
: Instruction(Ty, iType, Ops, NumOps, Name, InsertAtEnd) {}
+ // Out of line virtual method, so the vtable, etc has a home.
+ ~TerminatorInst();
+
/// Virtual methods - Terminators should overload these and provide inline
/// overrides of non-V methods.
virtual BasicBlock *getSuccessorV(unsigned idx) const = 0;
@@ -96,6 +99,8 @@
: Instruction(Ty, iType, &Op, 1, Name, IAE), Op(V, this) {
}
public:
+ // Out of line virtual method, so the vtable, etc has a home.
+ ~UnaryInstruction();
// Transparently provide more efficient getOperand methods.
Value *getOperand(unsigned i) const {
Index: llvm/include/llvm/Instruction.h
diff -u llvm/include/llvm/Instruction.h:1.71 llvm/include/llvm/Instruction.h:1.72
--- llvm/include/llvm/Instruction.h:1.71 Tue May 9 12:29:17 2006
+++ llvm/include/llvm/Instruction.h Wed Jun 21 11:53:47 2006
@@ -52,11 +52,9 @@
Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
const std::string &Name, BasicBlock *InsertAtEnd);
public:
-
- ~Instruction() {
- assert(Parent == 0 && "Instruction still linked in the program!");
- }
-
+ // Out of line virtual method, so the vtable, etc has a home.
+ ~Instruction();
+
/// mayWriteToMemory - Return true if this instruction may modify memory.
///
virtual bool mayWriteToMemory() const { return false; }
Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.36 llvm/include/llvm/Instructions.h:1.37
--- llvm/include/llvm/Instructions.h:1.36 Fri May 19 14:07:54 2006
+++ llvm/include/llvm/Instructions.h Wed Jun 21 11:53:47 2006
@@ -40,9 +40,10 @@
const std::string &Name = "", Instruction *InsertBefore = 0);
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align,
const std::string &Name, BasicBlock *InsertAtEnd);
-
public:
-
+ // Out of line virtual method, so the vtable, etc has a home.
+ virtual ~AllocationInst();
+
/// isArrayAllocation - Return true if there is an allocation size parameter
/// to the allocation instruction that is not 1.
///
More information about the llvm-commits
mailing list