IR: Remove unnecessary specialization of getSymTab(), NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 6 Oct 2015 21:31:07 +0000 (21:31 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 6 Oct 2015 21:31:07 +0000 (21:31 +0000)
The only specializations of `getSymTab()` were identical to the default
defined in `SymbolTableListTraits::getSymTab()`.  Remove the
specializations, and stop treating it like a configuration point.  Just
to be sure no one else accesses this, make it private.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249469 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/BasicBlock.h
include/llvm/IR/Function.h
include/llvm/IR/SymbolTableListTraits.h
lib/IR/SymbolTableListTraitsImpl.h

index d5a6584ab6870b68311a32d815af8dd9d54dd82c..d3a8ec3d3e6d6788b39da448780b43b6819c79a1 100644 (file)
@@ -40,8 +40,6 @@ template<> struct ilist_traits<BasicBlock>
   BasicBlock *provideInitialHead() const { return createSentinel(); }
   BasicBlock *ensureHead(BasicBlock*) const { return createSentinel(); }
   static void noteHead(BasicBlock*, BasicBlock*) {}
-
-  static ValueSymbolTable *getSymTab(Function *ItemParent);
 private:
   mutable ilist_half_node<BasicBlock> Sentinel;
 };
index 29799dd7fbeba36d5cffc6996aef7cd29c5c065a..c6486d1b4e54fc4b42b6102acdbf0ae39bf8e34f 100644 (file)
@@ -46,8 +46,6 @@ template<> struct ilist_traits<Argument>
   Argument *ensureHead(Argument*) const { return createSentinel(); }
   static void noteHead(Argument*, Argument*) {}
 
-  static ValueSymbolTable *getSymTab(Function *ItemParent);
-
 private:
   mutable ilist_half_node<Argument> Sentinel;
 };
@@ -626,16 +624,6 @@ private:
   void clearMetadata();
 };
 
-inline ValueSymbolTable *
-ilist_traits<BasicBlock>::getSymTab(Function *F) {
-  return F ? &F->getValueSymbolTable() : nullptr;
-}
-
-inline ValueSymbolTable *
-ilist_traits<Argument>::getSymTab(Function *F) {
-  return F ? &F->getValueSymbolTable() : nullptr;
-}
-
 template <>
 struct OperandTraits<Function> : public OptionalOperandTraits<Function> {};
 
index 87dd366b2abc1ed08df385d77dd46cf498a68d0f..a81ffe8fa0c306c095687effa6e46dc38cc8df3a 100644 (file)
@@ -58,10 +58,12 @@ public:
     return Par->*(Par->getSublistAccess((ValueSubClass*)nullptr));
   }
 
+private:
   static ValueSymbolTable *getSymTab(ItemParentClass *Par) {
     return Par ? toPtr(Par->getValueSymbolTable()) : nullptr;
   }
 
+public:
   void addNodeToList(ValueSubClass *V);
   void removeNodeFromList(ValueSubClass *V);
   void transferNodesFromList(ilist_traits<ValueSubClass> &L2,
index a18f98261abc5ffce00e0868f1908be521daa59a..10cb76ed31d7a39e2a328f4288fe452cf6e786b8 100644 (file)
@@ -29,13 +29,13 @@ 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(getListOwner());
+  ValueSymbolTable *OldST = getSymTab(getListOwner());
 
   // Do it.
   *Dest = Src;
   
   // Get the new SymTab object.
-  ValueSymbolTable *NewST = TraitsClass::getSymTab(getListOwner());
+  ValueSymbolTable *NewST = getSymTab(getListOwner());
   
   // If there is nothing to do, quick exit.
   if (OldST == NewST) return;
@@ -69,7 +69,7 @@ void SymbolTableListTraits<ValueSubClass,ItemParentClass>
   ItemParentClass *Owner = getListOwner();
   V->setParent(Owner);
   if (V->hasName())
-    if (ValueSymbolTable *ST = TraitsClass::getSymTab(Owner))
+    if (ValueSymbolTable *ST = getSymTab(Owner))
       ST->reinsertValue(V);
 }
 
@@ -78,7 +78,7 @@ void SymbolTableListTraits<ValueSubClass,ItemParentClass>
 ::removeNodeFromList(ValueSubClass *V) {
   V->setParent(nullptr);
   if (V->hasName())
-    if (ValueSymbolTable *ST = TraitsClass::getSymTab(getListOwner()))
+    if (ValueSymbolTable *ST = getSymTab(getListOwner()))
       ST->removeValueName(V->getValueName());
 }
 
@@ -93,8 +93,8 @@ void SymbolTableListTraits<ValueSubClass,ItemParentClass>
 
   // We only have to update symbol table entries if we are transferring the
   // instructions to a different symtab object...
-  ValueSymbolTable *NewST = TraitsClass::getSymTab(NewIP);
-  ValueSymbolTable *OldST = TraitsClass::getSymTab(OldIP);
+  ValueSymbolTable *NewST = getSymTab(NewIP);
+  ValueSymbolTable *OldST = getSymTab(OldIP);
   if (NewST != OldST) {
     for (; first != last; ++first) {
       ValueSubClass &V = *first;