New issue
Advanced search Search tips

Issue 754380 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

clang-format removes space between constructor's initialization list and open brace

Project Member Reported by michae...@chromium.org, Aug 10 2017

Issue description

clang-format version 5.0.0 (trunk 302580)

With #if/else/endif, clang-format eats the space (' ') character between the closing paren
of an initializer in a constructor's initialization list and the open brace for the function body:

```
LoooooooooooooooooooooooongClassName::LoooooooooooooooooooooooongClassName()
    : some_silly_long_named_data_member_(0),
#if defined(FOO)
      another_silly_long_named_data_member_(1) {
#else
      another_silly_long_named_data_member_(2) {
#endif
}

LoooooooooooooooooooooooongClassName::~LoooooooooooooooooooooooongClassName()
```

becomes

```
LoooooooooooooooooooooooongClassName::LoooooooooooooooooooooooongClassName()
    : some_silly_long_named_data_member_(0),
#if defined(FOO)
      another_silly_long_named_data_member_(1) {
#else
      another_silly_long_named_data_member_(2){
#endif
}

LoooooooooooooooooooooooongClassName::~LoooooooooooooooooooooooongClassName()
```

This example doesn't repro if you remove the destructor or if you add a statement to the constructor body.

In the wild: https://cs.chromium.org/chromium/src/chrome/browser/extensions/api/feedback_private/feedback_private_api.cc?type=cs&q=file:feedback_private_api.cc+new%5Cslogsourceaccessmanager&sq=package:chromium&l=98
 
Components: Tools

Sign in to add a comment