Skip to content

Commit

Permalink
TargetInfo.cpp - use castAs<> instead of getAs<> as we dereference th…
Browse files Browse the repository at this point in the history
…e pointer directly. NFCI.

castAs<> will assert the correct cast type instead of just returning null, which we then try to dereference immediately.
  • Loading branch information
RKSimon committed Nov 25, 2020
1 parent eb7ea5a commit 9d996c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/TargetInfo.cpp
Expand Up @@ -10394,7 +10394,7 @@ void RISCVABIInfo::computeInfo(CGFunctionInfo &FI) const {
if (!IsRetIndirect && RetTy->isScalarType() &&
getContext().getTypeSize(RetTy) > (2 * XLen)) {
if (RetTy->isComplexType() && FLen) {
QualType EltTy = RetTy->getAs<ComplexType>()->getElementType();
QualType EltTy = RetTy->castAs<ComplexType>()->getElementType();
IsRetIndirect = getContext().getTypeSize(EltTy) > FLen;
} else {
// This is a normal scalar > 2*XLen, such as fp128 on RV32.
Expand Down

0 comments on commit 9d996c0

Please sign in to comment.