mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-18 12:29:27 +00:00
dyn_cast_or_null should work just the same as dyn_cast does
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6394 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
aa101c3147
commit
1ff1da7ac9
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user