[all-commits] [llvm/llvm-project] 090dd6: [Sema] Fold VLAs to constant arrays in a few more ...

Erik Pilkington via All-commits all-commits at lists.llvm.org
Fri Dec 4 07:08:47 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 090dd647d98dc50a56a42fbba0f3f11b10a3a187
      https://github.com/llvm/llvm-project/commit/090dd647d98dc50a56a42fbba0f3f11b10a3a187
  Author: Erik Pilkington <erik.pilkington at gmail.com>
  Date:   2020-12-04 (Fri, 04 Dec 2020)

  Changed paths:
    M clang/include/clang/Sema/DeclSpec.h
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/CXX/basic/basic.types/p10.cpp
    M clang/test/Sema/decl-in-prototype.c
    M clang/test/Sema/vla.c
    M clang/test/SemaCXX/vla.cpp
    A clang/test/SemaObjC/variable-size-ivar.m

  Log Message:
  -----------
  [Sema] Fold VLAs to constant arrays in a few more contexts

552c6c2 removed support for promoting VLAs to constant arrays when the bounds
isn't an ICE, since this can result in miscompiling a conforming program that
assumes that the array is a VLA. Promoting VLAs for fields is still supported,
since clang doesn't support VLAs in fields, so no conforming program could have
a field VLA.

This change is really disruptive, so this commit carves out two more cases
where we promote VLAs which can't miscompile a conforming program:

 - When the VLA appears in an ivar -- this seems like a corollary to the field thing
 - When the VLA has an initializer -- VLAs can't have an initializer

Differential revision: https://reviews.llvm.org/D90871




More information about the All-commits mailing list