[pseudo] Allow mixed designated/undesignated init lists.
authorSam McCall <sam.mccall@gmail.com>
Mon, 27 Jun 2022 23:13:04 +0000 (01:13 +0200)
committerSam McCall <sam.mccall@gmail.com>
Tue, 28 Jun 2022 13:45:41 +0000 (15:45 +0200)
commit8cf28585a40311163a08840beee035097638d41d
tree3df9ba68de6a06b2c3afe3562476fcf9cc769572
parentf1cfaa956def453c2df086ce38665a2669246e5d
[pseudo] Allow mixed designated/undesignated init lists.

This isn't allowed by the standard grammar but is allowed in C, and clang/GCC
permit it as an extension.
It avoids the need to determine which type of list we have in error-recovery.

While here, also support array index designators `{ [4]=1 }` which are
also legal in C, and common extensions in C++.

Differential Revision: https://reviews.llvm.org/D128687
clang-tools-extra/pseudo/lib/cxx.bnf
clang-tools-extra/pseudo/test/cxx/mixed-designator.cpp [new file with mode: 0644]