@@ -404,7 +404,7 @@ AST_MATCHER(CXXConstructExpr, isSafeSpanTwoParamConstruct) {
if (Arg0Ty->isConstantArrayType()) {
const APSInt ConstArrSize =
-APSInt(cast(Arg0Ty)->getSize());
+APSInt(cast(Arg0Ty.getCanonicalType())->getSize());
ziqin
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/102953
>From d6c860de3facc37f27b17a26a01e48bc02b4659b Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Mon, 12 Aug 2024 11:57:17 -0700
Subject: [PATCH] [-Wunsafe-buffer-usage] Fix a bug in the ASTMatcher for span
@@ -404,7 +404,7 @@ AST_MATCHER(CXXConstructExpr, isSafeSpanTwoParamConstruct) {
if (Arg0Ty->isConstantArrayType()) {
const APSInt ConstArrSize =
-APSInt(cast(Arg0Ty)->getSize());
+APSInt(cast(Arg0Ty.getCanonicalType())->getSize());
haoNo
haoNoQ wrote:
Ah classic! Forgotten `.getCanonicalType()`s always get me.
https://github.com/llvm/llvm-project/pull/102953
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang-analysis
Author: Ziqing Luo (ziqingluo-90)
Changes
`QualType::isConstantArrayType()` checks canonical type. So a following cast
should be applied to canonical type as well:
```
if (Ty->isConstantArrayType())
cast(Ty.getCanoni
https://github.com/ziqingluo-90 created
https://github.com/llvm/llvm-project/pull/102953
`QualType::isConstantArrayType()` checks canonical type. So a following cast
should be applied to canonical type as well:
```
if (Ty->isConstantArrayType())
cast(Ty.getCanonicalType()); //
cast(Ty) is