Add a new pop_back() method

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-06-30 04:35:21 +00:00
parent b9b8959091
commit a7e26118a2
2 changed files with 16 additions and 0 deletions

View File

@ -85,6 +85,7 @@ public:
ValueSubclass *remove(iterator &DI); // Defined in ValueHolderImpl.h
ValueSubclass *remove(const iterator &DI); // Defined in ValueHolderImpl.h
void remove(ValueSubclass *D); // Defined in ValueHolderImpl.h
ValueSubclass *pop_back(); // Defined in ValueHolderImpl.h
void push_front(ValueSubclass *Inst); // Defined in ValueHolderImpl.h
void push_back(ValueSubclass *Inst); // Defined in ValueHolderImpl.h

View File

@ -59,6 +59,21 @@ ValueSubclass *ValueHolder<ValueSubclass,ItemParentType>::remove(iterator &DI) {
return i;
}
template<class ValueSubclass, class ItemParentType>
ValueSubclass *ValueHolder<ValueSubclass,ItemParentType>::pop_back() {
assert(!ValueList.empty() && "Can't pop_back an empty valuelist!");
ValueSubclass *i = ValueList.back();
ValueList.pop_back();
i->setParent(0); // I don't own you anymore... byebye...
// You don't get to be in the symbol table anymore... byebye
if (i->hasName() && Parent)
Parent->getSymbolTable()->remove(i);
return i;
}
template<class ValueSubclass, class ItemParentType>
ValueSubclass *ValueHolder<ValueSubclass,ItemParentType>
::remove(const iterator &DI) {