-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy path.clang-format
74 lines (54 loc) · 2.07 KB
/
.clang-format
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
Language: Cpp
BasedOnStyle: Google
# Reference
# clang doc ver 3: https://releases.llvm.org/3.4/tools/clang/docs/ClangFormatStyleOptions.html
# clang doc ver 12: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# 每行字符的限制,0表示没有限制
ColumnLimit: 150
# 不允许排序#include
SortIncludes: false
# 是否使用tab
UseTab: Never
# tab宽度
TabWidth: 4
# 缩进宽度
IndentWidth: 4
# 指针*在类型旁 int* a
PointerAlignment: Left
# x{ 1, 2, 3, 4 }; 而不是 x{1, 2, 3, 4};
Cpp11BracedListStyle: true
# 在template<...>后换行
AlwaysBreakTemplateDeclarations: true
# 不将只有一行的函数合并到一行,保留大括号换行,空函数除外
AllowShortFunctionsOnASingleLine: Empty
# 超过行长度限制的函数参数会一行一个
AlignAfterOpenBracket: Align
AllowAllParametersOfDeclarationOnNextLine: false
BinPackArguments: false
BinPackParameters: false
PenaltyBreakBeforeFirstCallParameter: 100
# 在namespace结尾不注释名称
FixNamespaceComments: false
# 在大括号前换行: Attach(始终将大括号附加到周围的上下文), Linux(除函数、命名空间和类定义,与Attach类似),
# Mozilla(除枚举、函数、记录定义,与Attach类似), Stroustrup(除函数定义、catch、else,与Attach类似),
# Allman(总是在大括号前换行), GNU(总是在大括号前换行,并对于控制语句的大括号增加额外的缩进), WebKit(在函数前换行), Custom
BreakBeforeBraces: Allman
# Do not indent public private
AccessModifierOffset: -4
# 不在注释后增加空格
CommentPragmas: '^[^ ]'
SpacesInAngles: false
# 对齐结尾注释
AlignTrailingComments: true
# 宏定义块
MacroBlockBegin: "^EXPORT_CLASS_BEGIN|BEGIN_BIND_MSG_AGENT|BEGIN_BIND_MSG"
MacroBlockEnd: "^EXPORT_CLASS_END|END_BIND_MSG_AGENT|END_BIND_MSG"
# 是否对齐使用反斜杠换行的反斜杠
AlignEscapedNewlines: Left
# template之后是否插入空格
SpaceAfterTemplateKeyword: false
# 继承列表的风格
BreakInheritanceList: BeforeComma
# 初始化列表的风格
BreakConstructorInitializers: BeforeComma