forked from OSchip/llvm-project
[clang] CheckSizelessVectorOperands - use castAs<> instead of getAs<> to avoid dereference of nullptr
Move the only uses of the cast to where they are dereferenced.
This commit is contained in:
parent
19de2a5768
commit
ce2b36e123
|
@ -10490,12 +10490,10 @@ QualType Sema::CheckSizelessVectorOperands(ExprResult &LHS, ExprResult &RHS,
|
|||
QualType LHSType = LHS.get()->getType().getUnqualifiedType();
|
||||
QualType RHSType = RHS.get()->getType().getUnqualifiedType();
|
||||
|
||||
const BuiltinType *LHSVecType = LHSType->getAs<BuiltinType>();
|
||||
const BuiltinType *RHSVecType = RHSType->getAs<BuiltinType>();
|
||||
|
||||
unsigned DiagID = diag::err_typecheck_invalid_operands;
|
||||
if ((OperationKind == ACK_Arithmetic) &&
|
||||
(LHSVecType->isSVEBool() || RHSVecType->isSVEBool())) {
|
||||
(LHSType->castAs<BuiltinType>()->isSVEBool() ||
|
||||
RHSType->castAs<BuiltinType>()->isSVEBool())) {
|
||||
Diag(Loc, DiagID) << LHSType << RHSType << LHS.get()->getSourceRange()
|
||||
<< RHS.get()->getSourceRange();
|
||||
return QualType();
|
||||
|
|
Loading…
Reference in New Issue