[PATCH] D151769: [NFC][CLANG] Fix nullptr dereference issue in HandleRISCVRVVVectorBitsTypeAttr()
Soumi Manna via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 30 19:13:38 PDT 2023
Manna created this revision.
Manna added a reviewer: erichkeane.
Herald added subscribers: VincentWu, vkmr, luismarques, sameer.abuasal, s.egerton, Jim, benna, psnobl, PkmX, rogfer01, shiva0217, kito-cheng, simoncook, arichardson.
Herald added a project: All.
Manna requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD.
Herald added a project: clang.
This patch uses castAs instead of getAs which will assert if the type doesn't match in In HandleRISCVRVVVectorBitsTypeAttr(clang::QualType &, clang::ParsedAttr &, clang::Sema &)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151769
Files:
clang/lib/Sema/SemaType.cpp
Index: clang/lib/Sema/SemaType.cpp
===================================================================
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -8331,7 +8331,7 @@
unsigned VecSize = static_cast<unsigned>(RVVVectorSizeInBits.getZExtValue());
ASTContext::BuiltinVectorTypeInfo Info =
- S.Context.getBuiltinVectorTypeInfo(CurType->getAs<BuiltinType>());
+ S.Context.getBuiltinVectorTypeInfo(CurType->castAs<BuiltinType>());
unsigned EltSize = S.Context.getTypeSize(Info.ElementType);
unsigned MinElts = Info.EC.getKnownMinValue();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151769.526870.patch
Type: text/x-patch
Size: 580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230531/8f2869c2/attachment-0001.bin>
More information about the cfe-commits
mailing list