[llvm-bugs] [Bug 52425] New: clang-format AlignArrayOfStructures crashes when seeing clauses of different number of members

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 5 13:07:52 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52425

            Bug ID: 52425
           Summary: clang-format AlignArrayOfStructures crashes when
                    seeing clauses of different number of members
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lichray at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 25426
  --> https://bugs.llvm.org/attachment.cgi?id=25426&action=edit
test case

Crashes when formatting

std::vector<std::vector<uint8_t>> var_len_seq{
    { 0x80 },
    { 0xf5 },
    { 0xc3, 0x7f },
    { 0xc3, 0xc0 },
    { 0xe1, 0x7f },
    { 0xe1, 0xc0 },
    { 0xe1, 0x81, 0x7f },
};

If I remove the last line, I get a bad result:

std::vector<std::vector<uint8_t>> var_len_seq{
    {0x80},
    { 0xf5   },
    { 0xc3,   0x7f},
    { 0xc3,   0xc0},
    { 0xe1,   0x7f},
    { 0xe1,   0xc0},
};

My _clang-format is

---
BasedOnStyle: Microsoft
AlignArrayOfStructures: Right

...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211105/db592001/attachment.html>


More information about the llvm-bugs mailing list