[clang] [clang-format] Fix crash involving array designators and dangling comma (PR #77045)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 5 00:55:46 PST 2024


================
@@ -21084,6 +21084,12 @@ TEST_F(FormatTest, CatchAlignArrayOfStructuresLeftAlignment) {
       "};",
       Style);
 
+  verifyNoCrash("Foo f[] = {\n"
+                "    [0] = { 1, },\n"
+                "    [1] { 1, },\n"
+                "};",
+                Style);
----------------
owenca wrote:

We should also add it to `CatchAlignArrayOfStructuresRightAlignment`.

https://github.com/llvm/llvm-project/pull/77045


More information about the cfe-commits mailing list