summaryrefslogtreecommitdiff
path: root/include/Support/ilist
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-04-23 16:17:53 +0000
committerChris Lattner <sabre@nondot.org>2003-04-23 16:17:53 +0000
commit011ce8d2e401855877803fb6d972a6f6c22242a5 (patch)
tree5d9934c2f6ffd8c56104fd448acd901313fd7fd1 /include/Support/ilist
parentea0f49e52436272c65b52fe1e83f5009aa191a21 (diff)
downloadllvm-011ce8d2e401855877803fb6d972a6f6c22242a5.tar.gz
llvm-011ce8d2e401855877803fb6d972a6f6c22242a5.tar.bz2
llvm-011ce8d2e401855877803fb6d972a6f6c22242a5.tar.xz
Allow autoconversion from ilist_iterator<T> to T* in a dyn_cast and friends
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5862 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/Support/ilist')
-rw-r--r--include/Support/ilist20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/Support/ilist b/include/Support/ilist
index 26a2a2569b..1d868f8a4a 100644
--- a/include/Support/ilist
+++ b/include/Support/ilist
@@ -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;
+ }
+};
+
//===----------------------------------------------------------------------===//
//