Author: Simon Pilgrim
Date: 2020-11-25T11:38:29Z
New Revision: 9d996c01aad5371ccf3790ce937b1cc85d1b07ab

URL: 
https://github.com/llvm/llvm-project/commit/9d996c01aad5371ccf3790ce937b1cc85d1b07ab
DIFF: 
https://github.com/llvm/llvm-project/commit/9d996c01aad5371ccf3790ce937b1cc85d1b07ab.diff

LOG: 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.

Added: 
    

Modified: 
    clang/lib/CodeGen/TargetInfo.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index 64240b1bde20c..06b24c0384d8a 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<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.


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to