Clang-format style rules for parentheses and access modifier

匆匆过客 提交于 2020-04-07 18:57:36

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!