问题
I trying to write my own clang-format style file. There are two aspects I cannot get them right.
How do I let it keep an empty line after public:, private:, protected:? For example, I would like to have
public :
ctor () {}
Instead of
public :
ctor () {}
The second issues is that is there a way to make it insert a space before parentheses when it is following and control statement and function definition. But no space before a function call. For example, I would want,
void func () {}
func()
The SpaceBeforeParens can be only one of Never, Always, ControlStatements. The last is closest to what I want, yet it still does not work the way I want. A minor related issue is that it always remove space before the parenthesis if it follows an unary operator, for example
C &operator=(const C &);
I am more used to
C &operator= (const C &);
来源:https://stackoverflow.com/questions/29736248/clang-format-style-rules-for-parentheses-and-access-modifier