Prevent warnings from the -Wshorten-64-to-32 flag.
[oota-llvm.git] / include / llvm / SymbolTableListTraits.h
index 099cfe0ca7fe256dd20502f5e1891f561b25e340..8166a4eee2415d809760e9f171fcb302df78d94c 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -39,10 +39,15 @@ template<typename Ty> struct ilist_traits;
 template<typename ValueSubClass, typename ItemParentClass>
 class SymbolTableListTraits {
   typedef ilist_traits<ValueSubClass> TraitsClass;
-  ItemParentClass *ItemParent;
 public:
-  SymbolTableListTraits() : ItemParent(0) {}
+  SymbolTableListTraits() {}
 
+  /// getListOwner - Return the object that owns this list.  If this is a list
+  /// of instructions, it returns the BasicBlock that owns them.
+  ItemParentClass *getListOwner() {
+    return reinterpret_cast<ItemParentClass*>(reinterpret_cast<char*>(this)-
+                                              TraitsClass::getListOffset());
+  }
   static ValueSubClass *getPrev(ValueSubClass *V) { return V->getPrev(); }
   static ValueSubClass *getNext(ValueSubClass *V) { return V->getNext(); }
   static const ValueSubClass *getPrev(const ValueSubClass *V) {
@@ -62,7 +67,6 @@ public:
                              ilist_iterator<ValueSubClass> first,
                              ilist_iterator<ValueSubClass> last);
 //private:
-  void setItemParent(ItemParentClass *IP) { ItemParent = IP; }
   template<typename TPtr>
   void setSymTabObject(TPtr *, TPtr);
 };