Issue 76563
Summary [clang-format] Do not move to new line after assignment operator
Labels clang-format
Assignees
Reporter MaJerle
    If the line is too long, part of it will get to new line, like so:

```c
    s_command.AddressDtrMode =
        (Rate == MX25LM51245G_DTR_TRANSFER) ? HAL_OSPI_ADDRESS_DTR_ENABLE : HAL_OSPI_ADDRESS_DTR_DISABLE;
```

While some longer code may get restructured to: 

```c
    s_command.DummyCycles =
        (Mode == MX25LM51245G_SPI_MODE)
            ? 0U
            : ((Rate == MX25LM51245G_DTR_TRANSFER) ? DUMMY_CYCLES_REG_OCTAL_DTR : DUMMY_CYCLES_REG_OCTAL);
```

Is it possible to force format to format long lines like below example?

```c
 s_command.AddressDtrMode = (Rate == MX25LM51245G_DTR_TRANSFER)
 ? HAL_OSPI_ADDRESS_DTR_ENABLE
 : HAL_OSPI_ADDRESS_DTR_DISABLE;

 s_command.DummyCycles = (Mode == MX25LM51245G_SPI_MODE)
 ? 0U
                                : ((Rate == MX25LM51245G_DTR_TRANSFER) ? DUMMY_CYCLES_REG_OCTAL_DTR : DUMMY_CYCLES_REG_OCTAL);
    //Or even like this
 s_command.DummyCycles =
        (Mode == MX25LM51245G_SPI_MODE)
 ? 0U
            : ((Rate == MX25LM51245G_DTR_TRANSFER)
 ? DUMMY_CYCLES_REG_OCTAL_DTR
                : DUMMY_CYCLES_REG_OCTAL);
```

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

Reply via email to