[PATCH] D137343: [clang] add -Wvla-stack-allocation
Tao Liang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 3 10:10:50 PDT 2022
Origami404 created this revision.
Herald added a project: All.
Origami404 edited the summary of this revision.
Origami404 edited the summary of this revision.
Origami404 added reviewers: aaron.ballman, efriedma.
Origami404 added a subscriber: inclyc.
Origami404 published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
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 at inclyc.cn>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D137343
Files:
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaType.cpp
clang/test/Sema/warn-vla.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137343.472974.patch
Type: text/x-patch
Size: 6605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221103/9d86cc6e/attachment-0001.bin>
More information about the cfe-commits
mailing list