[llvm-commits] CVS: llvm/include/Support/ilist

Chris Lattner lattner at cs.uiuc.edu
Wed Apr 23 11:19:01 PDT 2003


Changes in directory llvm/include/Support:

ilist updated: 1.5 -> 1.6

---
Log message:

Allow autoconversion from ilist_iterator<T> to T* in a dyn_cast and friends


---
Diffs of the changes:

Index: llvm/include/Support/ilist
diff -u llvm/include/Support/ilist:1.5 llvm/include/Support/ilist:1.6
--- llvm/include/Support/ilist:1.5	Mon Sep 16 11:46:17 2002
+++ llvm/include/Support/ilist	Wed Apr 23 11:17:53 2003
@@ -151,6 +151,26 @@
   pointer getNodePtrUnchecked() const { return NodePtr; }
 };
 
+// Allow ilist_iterators to convert into pointers to a node automatically when
+// used by the dyn_cast, cast, isa mechanisms...
+
+template<typename From> struct simplify_type;
+
+template<typename NodeTy> struct simplify_type<ilist_iterator<NodeTy> > {
+  typedef NodeTy* SimpleType;
+  
+  static SimpleType getSimplifiedValue(const ilist_iterator<NodeTy> &Node) {
+    return &*Node;
+  }
+};
+template<typename NodeTy> struct simplify_type<const ilist_iterator<NodeTy> > {
+  typedef NodeTy* SimpleType;
+  
+  static SimpleType getSimplifiedValue(const ilist_iterator<NodeTy> &Node) {
+    return &*Node;
+  }
+};
+
 
 //===----------------------------------------------------------------------===//
 //





More information about the llvm-commits mailing list