Issue 134198
Summary clang-format introduces unnecessary indentation for scope resolution operator
Labels clang-format
Assignees
Reporter jacobsa
    clang-format seems to sometimes get confused in the middle of a designated initialization epxression, causing it to introduce a new level of indentation for each scope resolution operator when trying to access names defined within a class. For example:

```c++
  CO_EXPECT_CALL(*wrapped_, ReconstructChunks)
 .WillOnce(
          c9::CoReturn(Reconstructor::
 ReconstructChunksResult{
                               .results =
 {
                                       {
 .result =
 Reconstructor::
 ReconstructChunksResult::
 ChunkDetails{
 .chunk_id =
 {
 .volume_id = colossus::TestVolumeIds::Get(colossus::
 D_VolumeUtil::Partition::kSsd),
 },
 .length =
 colossus::
 ChunkLength{
 200},
 },
                                       },
 {
                                           .result =
 Reconstructor::ReconstructChunksResult::ChunkDetails{
 .chunk_id =
 {
 .volume_id = colossus::
 TestVolumeIds::Get(colossus::D_VolumeUtil::Partition::kHdd),
 },
 .length =
 colossus::ChunkLength{
 200},
 },
                                       },
 {
                                           .result = absl::InternalError(
                                               "some error"),
                                       },
 {
                                           .result =
 Reconstructor::ReconstructChunksResult::ChunkDetails{
 .chunk_id =
 {
 .volume_id = colossus::
 TestVolumeIds::Get(colossus::D_VolumeUtil::Partition::kHdd),
 },
 .length =
 colossus::ChunkLength{
 200},
 },
                                       },
 },
                               .bytes_read_hdd = 100,
 .bytes_read_ssd = 300,
 }));
```

It looks like some of this is an effort to avoid hitting 80 columns, but it just makes things worse and the overall _expression_ goes over 80 columns and is very difficult to read. It's also not always necessary to avoid 80 columns: for example `Reconstructor::ReconstructChunksResult{` would all fit within 80 I believe.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to