[clang] [clang-format] Fix a bug in annotating function declaration names (PR #76206)

Matt Mundell via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 22 02:29:19 PST 2023


mattmundell wrote:

Thanks for doing this. Does it mean we would have to add every type we use to our config? It would be much more convenient if clang-format treated the argument list the same way as it does for definitions. For example

```
printf "int\niso_time(time_t) { return 1; }\n" | clang-format -style='{ AlwaysBreakAfterReturnType: All }'
```

gives

```
int
iso_time(time_t) {
  return 1;
}
```

whereas

```
printf "int\niso_time(time_t);\n" | clang-format -style='{ AlwaysBreakAfterReturnType: All }'
```

will need a config edit to work.

Other examples that are currently failing to line break:

```
printf "int\niso_time(struct example);\n" | clang-format -style='{ AlwaysBreakAfterReturnType: All }'
printf "typedef long long int rowid_t;\nint\niso_time(rowid_t);\n" | clang-format -style='{ AlwaysBreakAfterReturnType: All }'
```


https://github.com/llvm/llvm-project/pull/76206


More information about the cfe-commits mailing list