From 9d996c01aad5371ccf3790ce937b1cc85d1b07ab Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 24 Nov 2020 16:56:24 +0000 Subject: [PATCH] TargetInfo.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI. castAs<> will assert the correct cast type instead of just returning null, which we then try to dereference immediately. --- clang/lib/CodeGen/TargetInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 64240b1..06b24c0 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -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()->getElementType(); + QualType EltTy = RetTy->castAs()->getElementType(); IsRetIndirect = getContext().getTypeSize(EltTy) > FLen; } else { // This is a normal scalar > 2*XLen, such as fp128 on RV32. -- 2.7.4