From 0c05128aeaf8611f835ee59f96467100e1bec6dc Mon Sep 17 00:00:00 2001 From: "Manna, Soumi" Date: Tue, 30 May 2023 18:46:40 -0700 Subject: [PATCH] [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 --- clang/lib/AST/Type.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index bde8865..63a5159 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(); + const BuiltinType *BTy = castAs(); return Ctx.getBuiltinVectorTypeInfo(BTy).ElementType; } -- 2.7.4