[PATCH] D98363: [Sema] Fold VLA types in compound literals to constant arrays.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 10 11:25:56 PST 2021


efriedma created this revision.
efriedma added reviewers: rsmith, erik.pilkington, aaron.ballman.
efriedma requested review of this revision.
Herald added a project: clang.

Similar to variables with an initializer, this is never valid in standard C, so we can safely constant-fold as an extension.  I ran into this construct in a couple proprietary codebases.

While I'm here, drive-by fix for 090dd647 <https://reviews.llvm.org/rG090dd647d98dc50a56a42fbba0f3f11b10a3a187>: we should only fold variables with VLA types, not arbitrary variably modified types.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98363

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Sema/vla.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98363.329719.patch
Type: text/x-patch
Size: 5109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210310/5cd49017/attachment.bin>


More information about the cfe-commits mailing list