[cfe-dev] Clang-format and arguments in a function declaration

Ahmed Fasih via cfe-dev cfe-dev at lists.llvm.org
Wed Jan 24 07:54:25 PST 2018


Friends, a clang-format question: configured per [1], specifically
with `AlignConsecutiveDeclarations` set to true, clang-format version
6.0.0 (tags/google/stable/2017-11-14) outputs the following code:

```cpp
template< class T1, class T2 >
PlaneAardvarks< T1, T2 >::PlaneAardvarksTask::PlaneAardvarksTask(
PlaneAardvarks< T1, T2 > *        super,

const EventualizedPlanesGo< T1 > &p,

Plane< T2 > &plane, std::size_t planeStart,

std::size_t planeStop )
{
}
```

(Apologies if the long lines wrap in your email reader—I've included a
copy of the code at [2].)

Although I asked for alignment of consecutive declarations, I was
quite surprised to see clang-format aligning arguments (with access
modifiers!) of a templated function definition: see the spaces before
`super` to line up with `p`. I thought to ask if this was intended
behavior, or could it be that function argument lists are being
accidentally treated as declarations?

Many thanks,

Ahmed

[1] https://gist.github.com/fasiha/a86678bd2483a4d69b06d1790afe2d42

[2] https://gist.github.com/fasiha/a86678bd2483a4d69b06d1790afe2d42#file-plane-h



More information about the cfe-dev mailing list