[clang] Diagnose potential size confusion with VLA params (PR #129772)

2025-03-11 Thread via cfe-commits
@@ -10333,6 +10334,74 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } +// Loop over the parameters to see if any of the size expressions contains +// a DeclRefExpr which refers to a variable from an outer scope that is +//

[clang] Diagnose potential size confusion with VLA params (PR #129772)

2025-03-05 Thread via cfe-commits
@@ -10333,6 +10334,74 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } +// Loop over the parameters to see if any of the size expressions contains +// a DeclRefExpr which refers to a variable from an outer scope that is +//

[clang] Diagnose potential size confusion with VLA params (PR #129772)

2025-03-05 Thread via cfe-commits
@@ -10333,6 +10334,74 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } +// Loop over the parameters to see if any of the size expressions contains +// a DeclRefExpr which refers to a variable from an outer scope that is +//

[clang] Diagnose potential size confusion with VLA params (PR #129772)

2025-03-05 Thread via cfe-commits
@@ -10333,6 +10334,74 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } +// Loop over the parameters to see if any of the size expressions contains +// a DeclRefExpr which refers to a variable from an outer scope that is +//

[clang] Diagnose potential size confusion with VLA params (PR #129772)

2025-03-05 Thread via cfe-commits
@@ -10333,6 +10334,74 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } +// Loop over the parameters to see if any of the size expressions contains +// a DeclRefExpr which refers to a variable from an outer scope that is +//

[clang] Diagnose potential size confusion with VLA params (PR #129772)

2025-03-05 Thread via cfe-commits
@@ -10333,6 +10334,74 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } +// Loop over the parameters to see if any of the size expressions contains cor3ntin wrote: Can we - Put all of that in a separate function -

[clang] Diagnose potential size confusion with VLA params (PR #129772)

2025-03-04 Thread Martin Uecker via cfe-commits
@@ -0,0 +1,68 @@ +// RUN: %clang_cc1 %s -std=c23 -verify=expected,c -fsyntax-only +// RUN: %clang_cc1 %s -std=c23 -verify=good -fsyntax-only -Wno-vla +// RUN: %clang_cc1 -x c++ %s -verify -fsyntax-only +// RUN: %clang_cc1 -DCARET -fsyntax-only -std=c23 -fno-diagnostics-show-line-

[clang] Diagnose potential size confusion with VLA params (PR #129772)

2025-03-04 Thread Martin Uecker via cfe-commits
uecker wrote: And a final comment. While the main motivating use case for you may be VLAs in parameter declarations (although as heavy user of those, I never felt the need for such a warning), it would seem the warning would be relevant in cases where the arrays are not actually VLAs. In ge