How can I tell clang-format to indent visibility modifiers?

孤街浪徒 提交于 2019-12-08 15:56:01

问题


I want my visibility modifiers (public, protected and private) to be indented by clang-format who currently leaves them at the same level as the class declaration. I've looked for indent and visibility on a dump of the default format options but couldn't find anything.


回答1:


From the Clang-Format Style Options documentation:

AccessModifierOffset (int) The extra indent or outdent of access modifiers, e.g. public:.

So, add the appropriate entry to your .clang-format. For example,

AccessModifierOffset: 2


来源:https://stackoverflow.com/questions/29198963/how-can-i-tell-clang-format-to-indent-visibility-modifiers

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