Skip to content

Commit

Permalink
[NFC][CLANG] Fix nullptr dereference issue in HandleRISCVRVVVectorBit…
Browse files Browse the repository at this point in the history
…sTypeAttr()

This patch uses castAs instead of getAs which will assert if the type doesn't match in HandleRISCVRVVVectorBitsTypeAttr(clang::QualType &, clang::ParsedAttr &, clang::Sema &)

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D151769
  • Loading branch information
smanna12 committed May 31, 2023
1 parent 54a2994 commit 071d4ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8340,7 +8340,7 @@ static void HandleRISCVRVVVectorBitsTypeAttr(QualType &CurType,
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();

Expand Down

0 comments on commit 071d4ab

Please sign in to comment.