[clang] f64f760 - [NFC][CLANG] Fix nullptr dereference issue in Type::getSveEltType()
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 30 08:01:21 PDT 2023
Author: Manna, Soumi
Date: 2023-05-30T08:00:12-07:00
New Revision: f64f760e2d20340ef7d1a95c8598a90e42ac31e7
URL: https://github.com/llvm/llvm-project/commit/f64f760e2d20340ef7d1a95c8598a90e42ac31e7
DIFF: https://github.com/llvm/llvm-project/commit/f64f760e2d20340ef7d1a95c8598a90e42ac31e7.diff
LOG: [NFC][CLANG] Fix nullptr dereference issue in Type::getSveEltType()
This patch uses castAs instead of getAs which will assert if the type
doesn't match in clang::Type::getSveEltType(clang::ASTContext const &)
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D151525
Added:
Modified:
clang/lib/AST/Type.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 51e206d8c463..508965fc38e5 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -2434,7 +2434,7 @@ bool Type::isVLSTBuiltinType() const {
QualType Type::getSveEltType(const ASTContext &Ctx) const {
assert(isVLSTBuiltinType() && "unsupported type!");
- const BuiltinType *BTy = getAs<BuiltinType>();
+ const BuiltinType *BTy = castAs<BuiltinType>();
if (BTy->getKind() == BuiltinType::SveBool)
// Represent predicates as i8 rather than i1 to avoid any layout issues.
// The type is bitcasted to a scalable predicate type when casting between
More information about the cfe-commits
mailing list