dyn_cast_or_null should work just the same as dyn_cast does
authorChris Lattner <sabre@nondot.org>
Thu, 29 May 2003 15:07:48 +0000 (15:07 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 29 May 2003 15:07:48 +0000 (15:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6394 91177308-0d34-0410-b5e6-96231b3b80d8

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

index ba0a99a5598a69c2cd4bedb258e4cdc53c6f0189..491d16508378431bb139f2be5dc4616d2895419c 100644 (file)
@@ -207,7 +207,7 @@ inline typename cast_retty<X, Y*>::ret_type cast_or_null(Y *Val) {
 // be used to test for a type as well as cast if successful.  This should be
 // used in the context of an if statement like this:
 //
-//  if (const Instruction *I = dyn_cast<const Instruction>(myVal)) { ... }
+//  if (const Instruction *I = dyn_cast<Instruction>(myVal)) { ... }
 //
 
 template <class X, class Y>
@@ -219,8 +219,8 @@ inline typename cast_retty<X, Y>::ret_type dyn_cast(Y Val) {
 // value is accepted.
 //
 template <class X, class Y>
-inline typename cast_retty<X, Y*>::ret_type dyn_cast_or_null(Y *Val) {
-  return (Val && isa<X>(Val)) ? cast<X, Y*>(Val) : 0;
+inline typename cast_retty<X, Y>::ret_type dyn_cast_or_null(Y Val) {
+  return (Val && isa<X>(Val)) ? cast<X, Y>(Val) : 0;
 }
 
 
index ba0a99a5598a69c2cd4bedb258e4cdc53c6f0189..491d16508378431bb139f2be5dc4616d2895419c 100644 (file)
@@ -207,7 +207,7 @@ inline typename cast_retty<X, Y*>::ret_type cast_or_null(Y *Val) {
 // be used to test for a type as well as cast if successful.  This should be
 // used in the context of an if statement like this:
 //
-//  if (const Instruction *I = dyn_cast<const Instruction>(myVal)) { ... }
+//  if (const Instruction *I = dyn_cast<Instruction>(myVal)) { ... }
 //
 
 template <class X, class Y>
@@ -219,8 +219,8 @@ inline typename cast_retty<X, Y>::ret_type dyn_cast(Y Val) {
 // value is accepted.
 //
 template <class X, class Y>
-inline typename cast_retty<X, Y*>::ret_type dyn_cast_or_null(Y *Val) {
-  return (Val && isa<X>(Val)) ? cast<X, Y*>(Val) : 0;
+inline typename cast_retty<X, Y>::ret_type dyn_cast_or_null(Y Val) {
+  return (Val && isa<X>(Val)) ? cast<X, Y>(Val) : 0;
 }