merge of r49785 (from branches/ggreif/use-diet): pass V to dyn_cast by const referenc...
authorGabor Greif <ggreif@gmail.com>
Wed, 16 Apr 2008 11:43:47 +0000 (11:43 +0000)
committerGabor Greif <ggreif@gmail.com>
Wed, 16 Apr 2008 11:43:47 +0000 (11:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49787 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Casting.h

index 3a68817ce997264646f5a57206575fc2b3063eda..61b91343cb90fee14d0f262ce319fc1875677721 100644 (file)
@@ -221,7 +221,7 @@ 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(Val) {
+inline typename cast_retty<X, Y>::ret_type dyn_cast(const Y &Val) {
   return isa<X>(Val) ? cast<X, Y>(Val) : 0;
 }
 
@@ -229,7 +229,7 @@ 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(Val) {
+inline typename cast_retty<X, Y>::ret_type dyn_cast_or_null(const Y &Val) {
   return (Val && isa<X>(Val)) ? cast<X, Y>(Val) : 0;
 }