diff --git a/include/llvm/Function.h b/include/llvm/Function.h index bdae9cd02f5..9f4f23be088 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -48,12 +48,15 @@ private: template<> struct ilist_traits : public SymbolTableListTraits { - // createSentinel is used to create a node that marks the end of the list... - static Argument *createSentinel(); - static void destroySentinel(Argument *A) { delete A; } + Argument *createSentinel() const { + return const_cast(static_cast(&Sentinel)); + } + static void destroySentinel(Argument*) {} static iplist &getList(Function *F); static ValueSymbolTable *getSymTab(Function *ItemParent); static int getListOffset(); +private: + ilist_node Sentinel; }; class Function : public GlobalValue, public Annotable, diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index fefe082cb4e..258158f801e 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -26,13 +26,6 @@ iplist &ilist_traits::getList(Function *F) { return F->getBasicBlockList(); } -Argument *ilist_traits::createSentinel() { - Argument *Ret = new Argument(Type::Int32Ty); - // This should not be garbage monitored. - LeakDetector::removeGarbageObject(Ret); - return Ret; -} - iplist &ilist_traits::getList(Function *F) { return F->getArgumentList(); }