further simplifications arising from peruse of the more declarative interface
authorGabor Greif <ggreif@gmail.com>
Sat, 7 Mar 2009 10:49:57 +0000 (10:49 +0000)
committerGabor Greif <ggreif@gmail.com>
Sat, 7 Mar 2009 10:49:57 +0000 (10:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66333 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/BasicBlock.h
include/llvm/Function.h
include/llvm/Module.h
include/llvm/SymbolTableListTraits.h
lib/VMCore/BasicBlock.cpp
lib/VMCore/Function.cpp
lib/VMCore/Module.cpp

index 0d40909f0043f7b92192e86841dda0f5c5e96324..0de71008e767973d92defd24285f663ccac90d84 100644 (file)
@@ -46,7 +46,6 @@ template<> struct ilist_traits<Instruction>
   Instruction *ensureHead(Instruction*) const { return createSentinel(); }
   static void noteHead(Instruction*, Instruction*) {}
 
-  static iplist<Instruction> &getList(BasicBlock *BB);
   static ValueSymbolTable *getSymTab(BasicBlock *ItemParent);
 private:
   mutable ilist_node<Instruction> Sentinel;
index ff0b066a5e505fa9dfd04da876e857043a49d5dd..ccc006cfcfb2ea0e9265a89aec47a1bfb93c47f7 100644 (file)
@@ -43,7 +43,6 @@ template<> struct ilist_traits<BasicBlock>
   BasicBlock *ensureHead(BasicBlock*) const { return createSentinel(); }
   static void noteHead(BasicBlock*, BasicBlock*) {}
 
-  static iplist<BasicBlock> &getList(Function *F);
   static ValueSymbolTable *getSymTab(Function *ItemParent);
 private:
   mutable ilist_node<BasicBlock> Sentinel;
@@ -61,7 +60,6 @@ template<> struct ilist_traits<Argument>
   Argument *ensureHead(Argument*) const { return createSentinel(); }
   static void noteHead(Argument*, Argument*) {}
 
-  static iplist<Argument> &getList(Function *F);
   static ValueSymbolTable *getSymTab(Function *ItemParent);
 private:
   mutable ilist_node<Argument> Sentinel;
index d706615ac715b13ca5fef1cdb135b861f934bdd6..2564ddc5da0ecfe0869434f18993d99b4da40f95 100644 (file)
@@ -31,7 +31,6 @@ template<> struct ilist_traits<Function>
   // createSentinel is used to create a node that marks the end of the list.
   static Function *createSentinel();
   static void destroySentinel(Function *F) { delete F; }
-  static iplist<Function> &getList(Module *M);
   static inline ValueSymbolTable *getSymTab(Module *M);
 };
 template<> struct ilist_traits<GlobalVariable>
@@ -39,7 +38,6 @@ template<> struct ilist_traits<GlobalVariable>
   // createSentinel is used to create a node that marks the end of the list.
   static GlobalVariable *createSentinel();
   static void destroySentinel(GlobalVariable *GV) { delete GV; }
-  static iplist<GlobalVariable> &getList(Module *M);
   static inline ValueSymbolTable *getSymTab(Module *M);
 };
 template<> struct ilist_traits<GlobalAlias>
@@ -47,7 +45,6 @@ template<> struct ilist_traits<GlobalAlias>
   // createSentinel is used to create a node that marks the end of the list.
   static GlobalAlias *createSentinel();
   static void destroySentinel(GlobalAlias *GA) { delete GA; }
-  static iplist<GlobalAlias> &getList(Module *M);
   static inline ValueSymbolTable *getSymTab(Module *M);
 };
 
index b5ec20de600a703f6f475a58154355e345e57d57..44f64dc57f0c028b241711408b238846d04a039b 100644 (file)
@@ -46,7 +46,7 @@ public:
   /// of instructions, it returns the BasicBlock that owns them.
   ItemParentClass *getListOwner() {
     typedef iplist<ValueSubClass> ItemParentClass::*Sublist;
-               Sublist Sub(ItemParentClass::
+    Sublist Sub(ItemParentClass::
                 getSublistAccess(static_cast<ValueSubClass*>(0)));
     size_t Offset(size_t(&((ItemParentClass*)0->*Sub)));
     iplist<ValueSubClass>* Anchor(static_cast<iplist<ValueSubClass>*>(this));
@@ -54,6 +54,10 @@ public:
                                               Offset);
   }
 
+  static iplist<ValueSubClass> &getList(ItemParentClass *Par) {
+  return Par->*(Par->getSublistAccess((ValueSubClass*)0));
+}
+
   void addNodeToList(ValueSubClass *V);
   void removeNodeFromList(ValueSubClass *V);
   void transferNodesFromList(ilist_traits<ValueSubClass> &L2,
index 66ee99d1745c2df4b504a2957131579f3c698a2e..f68223155dcdd06ae2ec7aacda3e387bacc84f75 100644 (file)
@@ -31,10 +31,6 @@ ilist_traits<Instruction>::getSymTab(BasicBlock *BB) {
   return 0;
 }
 
-iplist<Instruction> &ilist_traits<Instruction>::getList(BasicBlock *BB) {
-  return BB->getInstList();
-}
-
 // Explicit instantiation of SymbolTableListTraits since some of the methods
 // are not in the public header file...
 template class SymbolTableListTraits<Instruction, BasicBlock>;
index 258158f801ea437590d86a51f980044788230851..3a991f62d84e355a266c63858dce9ed9f3dd3fa1 100644 (file)
 #include "llvm/ADT/StringExtras.h"
 using namespace llvm;
 
-iplist<BasicBlock> &ilist_traits<BasicBlock>::getList(Function *F) {
-  return F->getBasicBlockList();
-}
-
-iplist<Argument> &ilist_traits<Argument>::getList(Function *F) {
-  return F->getArgumentList();
-}
 
 // Explicit instantiations of SymbolTableListTraits since some of the methods
 // are not in the public header file...
index 47233aea682a130bd382d167bb3a5f3159de7d4e..25d297a03e31c8697127dbd7b65d074d8dff9f91 100644 (file)
@@ -52,16 +52,6 @@ GlobalAlias *ilist_traits<GlobalAlias>::createSentinel() {
   return Ret;
 }
 
-iplist<Function> &ilist_traits<Function>::getList(Module *M) {
-  return M->getFunctionList();
-}
-iplist<GlobalVariable> &ilist_traits<GlobalVariable>::getList(Module *M) {
-  return M->getGlobalList();
-}
-iplist<GlobalAlias> &ilist_traits<GlobalAlias>::getList(Module *M) {
-  return M->getAliasList();
-}
-
 // Explicit instantiations of SymbolTableListTraits since some of the methods
 // are not in the public header file.
 template class SymbolTableListTraits<GlobalVariable, Module>;