[clang] Diagnose potential size confusion with VLA params [contd.] (PR #181550)

Yeoul Na via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 12:53:06 PDT 2026


================
@@ -1114,7 +1114,8 @@ def VexingParse : DiagGroup<"vexing-parse">;
 def VLAUseStaticAssert : DiagGroup<"vla-extension-static-assert">;
 def VLACxxExtension : DiagGroup<"vla-cxx-extension", [VLAUseStaticAssert]>;
 def VLAExtension : DiagGroup<"vla-extension", [VLACxxExtension]>;
-def VLA : DiagGroup<"vla", [VLAExtension]>;
+def VLASizeConfusion : DiagGroup<"vla-potential-size-confusion">;
----------------
rapidsna wrote:

@AaronBallman Yes, I largely agree with this plan. Thanks for writing it up!

I think there are still two possibilities for `-Wname-confusion-parameter-array-sizes`:

1. Have a separate diagnostic flag for array size confusion in structs, e.g., `-Wname-confusion-field-array-sizes`.
2. Introduce a single flag that covers both parameters and structs, e.g., `-Wname-confusion-array-sizes`, and extend it to cover struct fields in a follow-up. This was my original intention, but I'm open to the first option too.

WDYT?

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


More information about the cfe-commits mailing list