[clang] [clang-format] Fix crashes in AlignArrayOfStructures (PR #72520)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 17 14:25:34 PST 2023


================
@@ -20709,6 +20709,18 @@ TEST_F(FormatTest, CatchExceptionReferenceBinding) {
 TEST_F(FormatTest, CatchAlignArrayOfStructuresRightAlignment) {
   auto Style = getLLVMStyle();
   Style.AlignArrayOfStructures = FormatStyle::AIAS_Right;
+
+  verifyNoCrash("f({\n"
+                "table({}, table({{\"\", false}}, {}))\n"
+                "});",
+                Style);
+  verifyNoCrash("Bar a[1] = {\n"
+                "    #define buf(a, b) \\\n"
+                "      { #a, #b },\n"
+                "    { Test, bar }\n"
+                "};",
+                Style);
----------------
owenca wrote:

```suggestion
  verifyNoCrash("f({\n"
                "table({}, table({{\"\", false}}, {}))\n"
                "});",
                Style);
```

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


More information about the cfe-commits mailing list