diff options
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/BasicBlock.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/Function.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/Module.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/SymbolTableListTraitsImpl.h | 17 |
4 files changed, 9 insertions, 14 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index e10948e2ad..431bb5090a 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -72,8 +72,6 @@ template class SymbolTableListTraits<Instruction, BasicBlock>; BasicBlock::BasicBlock(const std::string &Name, Function *NewParent, BasicBlock *InsertBefore) : Value(Type::LabelTy, Value::BasicBlockVal), Parent(0) { - // Initialize the instlist. - InstList.setItemParent(this); // Make sure that we get added to a function LeakDetector::addGarbageObject(this); diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index 7949e39f84..e47798e12c 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -143,8 +143,6 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage, : GlobalValue(PointerType::get(Ty), Value::FunctionVal, 0, 0, Linkage, name) { ParamAttrs = 0; CallingConvention = 0; - BasicBlocks.setItemParent(this); - ArgumentList.setItemParent(this); SymTab = new ValueSymbolTable(); assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy) diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp index 465cb69445..ddd503dea1 100644 --- a/lib/VMCore/Module.cpp +++ b/lib/VMCore/Module.cpp @@ -64,8 +64,6 @@ template class SymbolTableListTraits<Function, Module>; Module::Module(const std::string &MID) : ModuleID(MID), DataLayout("") { - FunctionList.setItemParent(this); - GlobalList.setItemParent(this); ValSymTab = new ValueSymbolTable(); TypeSymTab = new TypeSymbolTable(); } diff --git a/lib/VMCore/SymbolTableListTraitsImpl.h b/lib/VMCore/SymbolTableListTraitsImpl.h index ce2c0c0cc7..b2b6a3fa34 100644 --- a/lib/VMCore/SymbolTableListTraitsImpl.h +++ b/lib/VMCore/SymbolTableListTraitsImpl.h @@ -29,19 +29,19 @@ template<typename TPtr> void SymbolTableListTraits<ValueSubClass,ItemParentClass> ::setSymTabObject(TPtr *Dest, TPtr Src) { // Get the old symtab and value list before doing the assignment. - ValueSymbolTable *OldST = TraitsClass::getSymTab(ItemParent); + ValueSymbolTable *OldST = TraitsClass::getSymTab(getListOwner()); // Do it. *Dest = Src; // Get the new SymTab object. - ValueSymbolTable *NewST = TraitsClass::getSymTab(ItemParent); + ValueSymbolTable *NewST = TraitsClass::getSymTab(getListOwner()); // If there is nothing to do, quick exit. if (OldST == NewST) return; // Move all the elements from the old symtab to the new one. - iplist<ValueSubClass> &ItemList = TraitsClass::getList(ItemParent); + iplist<ValueSubClass> &ItemList = TraitsClass::getList(getListOwner()); if (ItemList.empty()) return; if (OldST) { @@ -66,9 +66,10 @@ template<typename ValueSubClass, typename ItemParentClass> void SymbolTableListTraits<ValueSubClass,ItemParentClass> ::addNodeToList(ValueSubClass *V) { assert(V->getParent() == 0 && "Value already in a container!!"); - V->setParent(ItemParent); + ItemParentClass *Owner = getListOwner(); + V->setParent(Owner); if (V->hasName()) - if (ValueSymbolTable *ST = TraitsClass::getSymTab(ItemParent)) + if (ValueSymbolTable *ST = TraitsClass::getSymTab(Owner)) ST->reinsertValue(V); } @@ -77,7 +78,7 @@ void SymbolTableListTraits<ValueSubClass,ItemParentClass> ::removeNodeFromList(ValueSubClass *V) { V->setParent(0); if (V->hasName()) - if (ValueSymbolTable *ST = TraitsClass::getSymTab(ItemParent)) + if (ValueSymbolTable *ST = TraitsClass::getSymTab(getListOwner())) ST->removeValueName(V->getValueName()); } @@ -87,12 +88,12 @@ void SymbolTableListTraits<ValueSubClass,ItemParentClass> ilist_iterator<ValueSubClass> first, ilist_iterator<ValueSubClass> last) { // We only have to do work here if transferring instructions between BBs - ItemParentClass *NewIP = ItemParent, *OldIP = L2.ItemParent; + ItemParentClass *NewIP = getListOwner(), *OldIP = L2.getListOwner(); if (NewIP == OldIP) return; // No work to do at all... // We only have to update symbol table entries if we are transferring the // instructions to a different symtab object... - ValueSymbolTable *NewST = TraitsClass::getSymTab(ItemParent); + ValueSymbolTable *NewST = TraitsClass::getSymTab(NewIP); ValueSymbolTable *OldST = TraitsClass::getSymTab(OldIP); if (NewST != OldST) { for (; first != last; ++first) { |