diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h index ed9794207a3..dc3ef1bcccb 100644 --- a/include/llvm/BasicBlock.h +++ b/include/llvm/BasicBlock.h @@ -40,8 +40,9 @@ template class PredIterator; template<> struct ilist_traits : public SymbolTableListTraits { - // createNode is used to create a node that marks the end of the list... - static Instruction *createNode(); + // createSentinal is used to create a node that marks the end of the list... + static Instruction *createSentinal(); + static void destroySentinal(Instruction *I) { delete I; } static iplist &getList(BasicBlock *BB); }; diff --git a/include/llvm/Function.h b/include/llvm/Function.h index a4545a79ab1..88d7d3457f6 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -31,17 +31,18 @@ class FunctionType; template<> struct ilist_traits : public SymbolTableListTraits { - // createNode is used to create a node that marks the end of the list... - static BasicBlock *createNode(); - + // createSentinal is used to create a node that marks the end of the list... + static BasicBlock *createSentinal(); + static void destroySentinal(BasicBlock *BB) { delete BB; } static iplist &getList(Function *F); }; template<> struct ilist_traits : public SymbolTableListTraits { - // createNode is used to create a node that marks the end of the list... - static Argument *createNode(); + // createSentinal is used to create a node that marks the end of the list... + static Argument *createSentinal(); + static void destroySentinal(Argument *A) { delete A; } static iplist &getList(Function *F); }; diff --git a/include/llvm/Module.h b/include/llvm/Module.h index 846b47f0576..c53ee4eb9a3 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -32,14 +32,16 @@ class SymbolTable; template<> struct ilist_traits : public SymbolTableListTraits { - // createNode is used to create a node that marks the end of the list... - static Function *createNode(); + // createSentinal is used to create a node that marks the end of the list. + static Function *createSentinal(); + static void destroySentinal(Function *F) { delete F; } static iplist &getList(Module *M); }; template<> struct ilist_traits : public SymbolTableListTraits { - // createNode is used to create a node that marks the end of the list... - static GlobalVariable *createNode(); + // createSentinal is used to create a node that marks the end of the list. + static GlobalVariable *createSentinal(); + static void destroySentinal(GlobalVariable *GV) { delete GV; } static iplist &getList(Module *M); };