[llvm-commits] [llvm] r49787 - /llvm/trunk/include/llvm/Support/Casting.h

Gabor Greif ggreif at gmail.com
Wed Apr 16 04:43:47 PDT 2008


Author: ggreif
Date: Wed Apr 16 06:43:47 2008
New Revision: 49787

URL: http://llvm.org/viewvc/llvm-project?rev=49787&view=rev
Log:
merge of r49785 (from branches/ggreif/use-diet): pass V to dyn_cast by const reference, this avoids copy-constructing and destructing all the time. especially important if these constructors are not accessible

Modified:
    llvm/trunk/include/llvm/Support/Casting.h

Modified: llvm/trunk/include/llvm/Support/Casting.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Casting.h?rev=49787&r1=49786&r2=49787&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/Casting.h (original)
+++ llvm/trunk/include/llvm/Support/Casting.h Wed Apr 16 06:43:47 2008
@@ -221,7 +221,7 @@
 //
 
 template <class X, class Y>
-inline typename cast_retty<X, Y>::ret_type dyn_cast(Y 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 @@
 // value is accepted.
 //
 template <class X, class Y>
-inline typename cast_retty<X, Y>::ret_type dyn_cast_or_null(Y 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;
 }
 





More information about the llvm-commits mailing list