mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 17:24:48 +00:00
[C++11] More 'nullptr' conversion or in some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205831 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -245,7 +245,7 @@ inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
|
||||
template <class X, class Y>
|
||||
LLVM_ATTRIBUTE_UNUSED_RESULT inline typename cast_retty<X, Y *>::ret_type
|
||||
cast_or_null(Y *Val) {
|
||||
if (Val == 0) return 0;
|
||||
if (!Val) return nullptr;
|
||||
assert(isa<X>(Val) && "cast_or_null<Ty>() argument of incompatible type!");
|
||||
return cast<X>(Val);
|
||||
}
|
||||
@ -263,13 +263,13 @@ template <class X, class Y>
|
||||
LLVM_ATTRIBUTE_UNUSED_RESULT inline typename std::enable_if<
|
||||
!is_simple_type<Y>::value, typename cast_retty<X, const Y>::ret_type>::type
|
||||
dyn_cast(const Y &Val) {
|
||||
return isa<X>(Val) ? cast<X>(Val) : 0;
|
||||
return isa<X>(Val) ? cast<X>(Val) : nullptr;
|
||||
}
|
||||
|
||||
template <class X, class Y>
|
||||
LLVM_ATTRIBUTE_UNUSED_RESULT inline typename cast_retty<X, Y>::ret_type
|
||||
dyn_cast(Y &Val) {
|
||||
return isa<X>(Val) ? cast<X>(Val) : 0;
|
||||
return isa<X>(Val) ? cast<X>(Val) : nullptr;
|
||||
}
|
||||
|
||||
template <class X, class Y>
|
||||
|
Reference in New Issue
Block a user