[llvm-bugs] [Bug 52424] New: clang-format AlignArrayOfStructures gives incomprehensible results

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 5 13:02:18 PDT 2021


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

            Bug ID: 52424
           Summary: clang-format AlignArrayOfStructures gives
                    incomprehensible results
           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 25424
  --> https://bugs.llvm.org/attachment.cgi?id=25424&action=edit
test case 1

This seems to be related to straight nested braces. I have two test cases:

case 1:

LZ4F_preferences_t prefs = { {
    LZ4F_default,
    LZ4F_blockLinked,
    LZ4F_contentChecksumEnabled,
    LZ4F_frame,
    cbSource,
    0,
    LZ4F_blockChecksumEnabled,
} };

trunk gives

LZ4F_preferences_t prefs = {
    {
     LZ4F_default, LZ4F_blockLinked,
     LZ4F_contentChecksumEnabled, LZ4F_frame,
     cbSource, 0,
     LZ4F_blockChecksumEnabled, }
};

13.0.0 crashes.

case 2:

class Derived : Base
{
    void foo()
    {
#ifndef _MSC_VER
        const Object object = { {SOME_MACRO, { opt, someMember }} };
#else
#endif
    }
};

trunk & 13.0.0 give

class Derived : Base
{
    void foo()
    {
#ifndef _MSC_VER
        const Object object = {
            {SOME_MACRO,
             { opt,
             someMember }}
        };
#else
#endif
    }
};

-- 
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/1a46949a/attachment.html>


More information about the llvm-bugs mailing list