Regularize the names of #include-guards.
[oota-llvm.git] / include / Support / ilist
index 26a2a2569ba9f8c641bdb54ae6d950b61f2e6f1c..ce906ba559cbfd8d7c67bbb3dab3d5f76231b81b 100644 (file)
@@ -28,8 +28,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef INCLUDED_SUPPORT_ILIST
-#define INCLUDED_SUPPORT_ILIST
+#ifndef SUPPORT_ILIST
+#define SUPPORT_ILIST
 
 #include <assert.h>
 #include <algorithm>
@@ -151,6 +151,26 @@ public:
   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;
+  }
+};
+
 
 //===----------------------------------------------------------------------===//
 //