New behaviors:
-Wvla: produces portability warning for all VLAs like before
-Wvla-portability: not exists (equal to -Wvla)
-Wvla-stack-allocation -Wno-vla: only warns for VLAs that need stack allocation
-Wvla -Wvla-stack-allocation: warn for VLAs that need stack allocation, and give portablility warnings for other VLAs
Note that only one warning can be produced by one VLA because of
implementation complexity. Currently, VLAs are detected in
BuildArrayType, which will be used both by Parser and Tree Transformer.
And it passes the VLA-related warnings as an argument to other
functions. Producing multiple warnings for one VLA needs to change many
functions.
Fixes: https://github.com/llvm/llvm-project/issues/57098
Link: https://reviews.llvm.org/D132952
Co-authored-by: YingChi Long <me@inclyc.cn>
FWIW, I don't think this is a behavior we need to retain. I think we issued that warning because it was easier than suppressing it, but the error diagnostic suffices to let the user know what's gone wrong in this particular case.