Author: Manna, Soumi
Date: 2023-05-30T18:46:56-07:00
New Revision: 0c05128aeaf8611f835ee59f96467100e1bec6dc

URL: 
https://github.com/llvm/llvm-project/commit/0c05128aeaf8611f835ee59f96467100e1bec6dc
DIFF: 
https://github.com/llvm/llvm-project/commit/0c05128aeaf8611f835ee59f96467100e1bec6dc.diff

LOG: [NFC][CLANG] Fix nullptr dereference issue in Type::getRVVEltType()

This patch uses castAs instead of getAs which will assert if the type
doesn't match in clang::Type::getRVVEltType(clang::ASTContext const &)

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D151721

Added: 
    

Modified: 
    clang/lib/AST/Type.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index bde88653417d..63a5159ba703 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -2463,7 +2463,7 @@ bool Type::isRVVVLSBuiltinType() const {
 QualType Type::getRVVEltType(const ASTContext &Ctx) const {
   assert(isRVVVLSBuiltinType() && "unsupported type!");
 
-  const BuiltinType *BTy = getAs<BuiltinType>();
+  const BuiltinType *BTy = castAs<BuiltinType>();
   return Ctx.getBuiltinVectorTypeInfo(BTy).ElementType;
 }
 


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

Reply via email to