[cfe-users] Clang-Format: Spacing around operator function definitions

David Blaikie via cfe-users cfe-users at lists.llvm.org
Fri Apr 8 08:12:26 PDT 2016


+Daniel Jasper, one of the clang-format developers

On Fri, Apr 8, 2016 at 12:13 AM, Felix Mauch via cfe-users <
cfe-users at lists.llvm.org> wrote:

> Hi all,
>
> I recently stumbled across clang-format and I really like it so far :)
> However, I was not able to reproduce some of our csg guidelines.


(not familiar with 'csg' here)


> Maybe I was too stupid configuring this, but as far as I can see those
> things are not working atm (I am using version 3.6), am I right?
>

Possible formatting options are added on an as-needed and as-justified
basis. The complexity of the tool could grow out of control if any/every
possible formatting option were added, so I believe the general policy is
that only formatting options that are used in a large open source project
or otherwise published coding standard are supported. Are the formatting
options you're interested in used (not necessarily by yourself, mind you)
in either such situation?


>
> 1. Spacing around operator function definitions
> At my company we like to ad spaces around the operators when defining
> operator functions, for example:
>
> // Note the spaces around '==':
> bool operator == (const Type& other) const
> {
>   return (m_member == other.m_member);
> }
>
> I could not find anything handling this kind of stuff in clang-format. I
> also gave it a shot to quickly grep through the sourcecode, but couldn't
> find anything either. Is this simply not possible? What would be the
> starting point for implementing this?
>
> 2. Initializer lists each in one line, comma at the end
> I wasn't able to reproduce this. Either everything was in a separate line,
> with the comma aligned to the colon, or if possible the initializer list
> was wrapped into one line. I agree, that the comma-colon-aligning makes
> sense, however it does not fit our csg ;)
> Is it possible to force putting every member into a separate line but
> keeping the comma at the end?
>
> Cheers
> Felix
> _______________________________________________
> cfe-users mailing list
> cfe-users at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20160408/441ee989/attachment.html>


More information about the cfe-users mailing list