[clang] [clang] Report Diagnostic when builtin vector has negative size (PR #166055)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 3 08:47:53 PST 2025


================
@@ -8306,6 +8316,14 @@ static void HandleExtVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr,
   QualType T = S.BuildExtVectorType(CurType, SizeExpr, Attr.getLoc());
   if (!T.isNull())
     CurType = T;
+
+  std::optional<llvm::APSInt> VecSize =
+      SizeExpr->getIntegerConstantExpr(S.Context);
+  if (VecSize && VecSize->isNegative()) {
----------------
AaronBallman wrote:

Similar, I think this should live in `BuildExtVectorType()`.

https://github.com/llvm/llvm-project/pull/166055


More information about the cfe-commits mailing list