mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-22 19:49:49 +00:00
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
6d05ce493b
commit
32b4942a0a
@ -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
Block a user