Allow dyn_cast to operate on things that aren't OBVIOUSLY a pointer type.
authorChris Lattner <sabre@nondot.org>
Wed, 23 Apr 2003 16:17:28 +0000 (16:17 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 23 Apr 2003 16:17:28 +0000 (16:17 +0000)
These things can be converted to a pointer, like ilist_iterators

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5861 91177308-0d34-0410-b5e6-96231b3b80d8

include/Support/Casting.h
include/llvm/Support/Casting.h

index e0d50fe5d552c327d19a505ab69d160d9868b91a..ba0a99a5598a69c2cd4bedb258e4cdc53c6f0189 100644 (file)
@@ -211,8 +211,8 @@ inline typename cast_retty<X, Y*>::ret_type cast_or_null(Y *Val) {
 //
 
 template <class X, class Y>
-inline typename cast_retty<X, Y*>::ret_type dyn_cast(Y *Val) {
-  return isa<X>(Val) ? cast<X, Y*>(Val) : 0;
+inline typename cast_retty<X, Y>::ret_type dyn_cast(Y Val) {
+  return isa<X>(Val) ? cast<X, Y>(Val) : 0;
 }
 
 // dyn_cast_or_null<X> - Functionally identical to dyn_cast, except that a null
index e0d50fe5d552c327d19a505ab69d160d9868b91a..ba0a99a5598a69c2cd4bedb258e4cdc53c6f0189 100644 (file)
@@ -211,8 +211,8 @@ inline typename cast_retty<X, Y*>::ret_type cast_or_null(Y *Val) {
 //
 
 template <class X, class Y>
-inline typename cast_retty<X, Y*>::ret_type dyn_cast(Y *Val) {
-  return isa<X>(Val) ? cast<X, Y*>(Val) : 0;
+inline typename cast_retty<X, Y>::ret_type dyn_cast(Y Val) {
+  return isa<X>(Val) ? cast<X, Y>(Val) : 0;
 }
 
 // dyn_cast_or_null<X> - Functionally identical to dyn_cast, except that a null