forked from OSchip/llvm-project
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
llvm-svn: 49787
This commit is contained in:
parent
e45b8f89c5
commit
522dc99164
|
@ -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(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 @@ 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) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue