[clang] 6279d2e - AArch64ABIInfo::passAsAggregateType - don't directly dereference getAs<> result. NFC.

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 31 06:43:03 PST 2024


Author: Simon Pilgrim
Date: 2024-12-31T14:34:14Z
New Revision: 6279d2e0f33ed1aa686aace48da6ccf912ab4b28

URL: https://github.com/llvm/llvm-project/commit/6279d2e0f33ed1aa686aace48da6ccf912ab4b28
DIFF: https://github.com/llvm/llvm-project/commit/6279d2e0f33ed1aa686aace48da6ccf912ab4b28.diff

LOG: AArch64ABIInfo::passAsAggregateType - don't directly dereference getAs<> result. NFC.

Reported by coverity static analyzer - we know the type is a BuiltinType so use castAs<>

Added: 
    

Modified: 
    clang/lib/CodeGen/Targets/AArch64.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/Targets/AArch64.cpp b/clang/lib/CodeGen/Targets/AArch64.cpp
index ad7f405cc72550..0680b4828b6daf 100644
--- a/clang/lib/CodeGen/Targets/AArch64.cpp
+++ b/clang/lib/CodeGen/Targets/AArch64.cpp
@@ -662,7 +662,7 @@ bool AArch64ABIInfo::isZeroLengthBitfieldPermittedInHomogeneousAggregate()
 
 bool AArch64ABIInfo::passAsAggregateType(QualType Ty) const {
   if (Kind == AArch64ABIKind::AAPCS && Ty->isSVESizelessBuiltinType()) {
-    const auto *BT = Ty->getAs<BuiltinType>();
+    const auto *BT = Ty->castAs<BuiltinType>();
     return !BT->isSVECount() &&
            getContext().getBuiltinVectorTypeInfo(BT).NumVectors > 1;
   }


        


More information about the cfe-commits mailing list