[clang] [clang-tools-extra] [clang][ASTMatchers] Fix `hasArraySize` crash without a size expression (PR #215082)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 9 04:08:30 PDT 2026
================
@@ -8652,8 +8652,8 @@ AST_MATCHER_P(CXXNewExpr, hasAnyPlacementArg, internal::Matcher<Expr>,
/// cxxNewExpr(hasArraySize(integerLiteral(equals(10))))
/// matches the expression 'new MyClass[10]'.
AST_MATCHER_P(CXXNewExpr, hasArraySize, internal::Matcher<Expr>, InnerMatcher) {
- return Node.isArray() && *Node.getArraySize() &&
- InnerMatcher.matches(**Node.getArraySize(), Finder, Builder);
+ const auto ArraySize = Node.getArraySize();
----------------
zwuis wrote:
Write its real type.
https://github.com/llvm/llvm-project/pull/215082
More information about the cfe-commits
mailing list