Issue 52981
Summary Respect the column limit when aligning arrays of structs
Labels new issue
Assignees
Reporter Julien-Elie
    When aligning arrays of structs with clang-format 13, the maximum line length does not seem to be taken into account.

For instance:

```
static COMMAND Commands[] = {
    { "drop",         "site\t\t\tStop feeding site",
      1,  SC_DROP,           false },
    { "flushlogs",    "\t\t\tFlush log files",
      0,  SC_FLUSHLOGS,      false },
    { "go",           "reason...\t\t\tRestart after pause or throttle",
      1,  SC_GO,             true },
    { "pause",        "reason...\t\tShort-term pause in accepting articles",
      1,  SC_PAUSE,          true },
    { "stathist",     "filename|off\t\tLog into filename some history stats",
      1,  SC_STATHIST,       false },
    { "status",       "interval|off\t\tTurn innd status generation on or off",
      1,  SC_STATUS,         false }
};
```

becomes:

```
static COMMAND Commands[] = {
    {"drop",      "site\t\t\tStop feeding site",                           1, SC_DROP,      false},          
    {"flushlogs", "\t\t\tFlush log files",                                 0, SC_FLUSHLOGS, false},
    {"go",        "reason...\t\t\tRestart after pause or throttle",        1, SC_GO,        true },          
    {"pause",     "reason...\t\tShort-term pause in accepting articles",   1,
     SC_PAUSE,                                                                              true },   
    {"stathist",  "filename|off\t\tLog into filename some history stats",  1,
     SC_STATHIST,                                                                           false},
    {"status",    "interval|off\t\tTurn innd status generation on or off", 1,
     SC_STATUS,                                                                             false}
};
```

which is larger than the expected `ColumnLimit` of 79.
Couldn't all lines we wrapped after the second or third member of the struct?

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to