Refactor SymbolTableListTraits to only have a single pointer in it, instead
[oota-llvm.git] / include / llvm / Module.h
index 3d68e736bfc4da4c7e94c48f20706334d01f1350..e645f51c1c3a426fddaabf8c9e029a1560795288 100644 (file)
@@ -26,18 +26,20 @@ class GlobalValueRefMap;   // Used by ConstantVals.cpp
 class FunctionType;
 
 template<> struct ilist_traits<Function>
-  : public SymbolTableListTraits<Function, Module, Module> {
+  : public SymbolTableListTraits<Function, Module> {
   // 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>
-  : public SymbolTableListTraits<GlobalVariable, Module, Module> {
+  : public SymbolTableListTraits<GlobalVariable, Module> {
   // 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);
 };
 
 /// A Module instance is used to store all the information related to an
@@ -319,6 +321,17 @@ inline std::ostream &operator<<(std::ostream &O, const Module &M) {
   return O;
 }
 
+inline ValueSymbolTable *
+ilist_traits<Function>::getSymTab(Module *M) {
+  return M ? &M->getValueSymbolTable() : 0;
+}
+
+inline ValueSymbolTable *
+ilist_traits<GlobalVariable>::getSymTab(Module *M) {
+  return M ? &M->getValueSymbolTable() : 0;
+}
+
+
 } // End llvm namespace
 
 #endif