-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.clang-format
180 lines (175 loc) · 6.5 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# Language: Cpp
# BasedOnStyle: WebKit
# AccessModifierOffset: -4
# AlignAfterOpenBracket: Align
# AlignConsecutiveAssignments: None
# AlignOperands: Align
# AllowAllArgumentsOnNextLine: true
# AllowAllConstructorInitializersOnNextLine: true
# AllowAllParametersOfDeclarationOnNextLine: false
# AllowShortBlocksOnASingleLine: Empty
# AllowShortCaseLabelsOnASingleLine: true
# AllowShortEnumsOnASingleLine: true
# AllowShortFunctionsOnASingleLine: Inline
# AllowShortIfStatementsOnASingleLine: Never # To avoid conflict, set this "Never" and each "if statement" should include brace when coding
# AllowShortLambdasOnASingleLine: Inline
# AllowShortLoopsOnASingleLine: false
# AlwaysBreakAfterReturnType: None
# AlwaysBreakTemplateDeclarations: Yes
# BinPackArguments: true
# BreakBeforeBraces: Custom
# BraceWrapping:
# AfterCaseLabel: false
# AfterClass: false
# AfterStruct: false
# AfterControlStatement: Never
# AfterEnum: false
# AfterFunction: false
# AfterNamespace: false
# AfterUnion: false
# AfterExternBlock: false
# BeforeCatch: false
# BeforeElse: false
# BeforeLambdaBody: false
# IndentBraces: false
# SplitEmptyFunction: false
# SplitEmptyRecord: false
# SplitEmptyNamespace: false
# BreakBeforeBinaryOperators: None
# BreakBeforeTernaryOperators: true
# BreakConstructorInitializers: BeforeColon
# BreakInheritanceList: BeforeColon
# ColumnLimit: 120
# CompactNamespaces: false
# ConstructorInitializerAllOnOneLineOrOnePerLine: false
# ConstructorInitializerIndentWidth: 4
# ContinuationIndentWidth: 4
# Cpp11BracedListStyle: true
# DerivePointerAlignment: false # Make sure the * or & align on the left
# EmptyLineBeforeAccessModifier: LogicalBlock
# ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
# IncludeCategories:
# - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
# Priority: 2
# - Regex: '^(<|"(gtest|isl|json)/)'
# Priority: 3
# - Regex: '.*'
# Priority: 1
# FixNamespaceComments: true
# IncludeBlocks: Preserve
# IndentCaseLabels: true
# IndentPPDirectives: None
# IndentWidth: 4
# KeepEmptyLinesAtTheStartOfBlocks: true
# MaxEmptyLinesToKeep: 1
# NamespaceIndentation: None
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: true
# PointerAlignment: Left
# ReflowComments: false
# # SeparateDefinitionBlocks: Always # Only support since clang-format 14
# SpaceAfterCStyleCast: false
# SpaceAfterLogicalNot: false
# SpaceAfterTemplateKeyword: true
# SpaceBeforeAssignmentOperators: true
# SpaceBeforeCpp11BracedList: false
# SpaceBeforeCtorInitializerColon: true
# SpaceBeforeInheritanceColon: true
# SpaceBeforeParens: ControlStatements
# SpaceBeforeRangeBasedForLoopColon: true
# SpaceBeforeSquareBrackets: false
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 2
# SpacesInAngles: false
# SpacesInCStyleCastParentheses: false
# SpacesInContainerLiterals: false
# SpacesInParentheses: false
# SpacesInSquareBrackets: false
# Standard: c++17
# TabWidth: 4
# UseTab: Never
---
Language: Cpp
#圆括号之后,多行内容,进行对齐
AlignAfterOpenBracket: Align
#连续赋值时,对齐所有等号
# AlignConsecutiveAssignments: true
#连续声明时,对齐所有声明的变量名
# AlignConsecutiveDeclarations: true
AccessModifierOffset: -4
#连续宏定义时,对齐所有定义值
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
#AlignOperands Align将对齐分割到多行上的单个表达式的操作数
AlignOperands: Align
#对齐连续的尾随的注释
AlignTrailingComments: true
#允许将一个函数声明的所有参数移到下一行.
AllowAllParametersOfDeclarationOnNextLine: false
#将简单的语句块放到一个单行
AllowShortBlocksOnASingleLine: false
#if (a) return;放单行 属性:Never、WithoutElse没有else的可以放单行、OnlyFirstIf只有第一个if放单行、AllIfsAndElse总是把简短的if, else if和else语句放在同一行。
AllowShortIfStatementsOnASingleLine: Never
AllowShortEnumsOnASingleLine: true
#模板定义换行
AlwaysBreakTemplateDeclarations: true
#BinPackArguments:如果为false,函数调用的参数要么全部在同一行,要么各有一行。
BinPackArguments: false
#BinPackParameters:如果为false,函数声明或函数定义的参数将全部在同一行或各有一行。
BinPackParameters: false
BreakBeforeBraces: Custom
# 控制单独的大括号换行事件,只有当BreakBeforeBraces设置为Custom时才有效
BraceWrapping:
#使控制语句(if/for/while/switch/..)换行。
AfterControlStatement: false
#使枚举定义换行。
AfterEnum: true
#使函数定义换行。
AfterFunction: true
#使结构定义换行。
AfterStruct: true
#使共同体定义换行。
AfterUnion: true
#在else之前换行。
BeforeElse: false
#换行大括号缩进。
IndentBraces: false
#空函数是否可以放在单行:false允许 true不允许
SplitEmptyFunction: false
#空类,结构或联合主体是否可以放在单行:false允许 true不允许
SplitEmptyRecord: false
#空namespace是否可以放在单行:false允许 true不允许
SplitEmptyNamespace: true
SpaceBeforeParens: Custom
#控制圆括号前的单独空格,只有当SpaceBeforeParens设置为Custom时才有效
SpaceBeforeParensOptions:
#在控制语句关键字(for/if/while…)和开括号之间放置空格
AfterControlStatements: true
#在函数声明名称和开括号之间不允许使用空格
AfterFunctionDeclarationName: false
#指针对齐:右
PointerAlignment: Right
# 三元运算符将被放置在换行后
BreakBeforeTernaryOperators: true
#每行字符的限制,0表示没有限制
ColumnLimit: 120
#缩进空格宽度:4
IndentWidth: 4
#保留在赋值操作符之前的空格
SpaceBeforeAssignmentOperators: true
#不要排序include的头文件
SortIncludes: true #Never
#允许重新排版注释
ReflowComments: true
#尾行注释前的空格数
SpacesBeforeTrailingComments: 2
#连续空行的最大数量
MaxEmptyLinesToKeep: 1
#使用tab字符: Never从不使用, ForIndentation仅在缩进时使用制表符, ForContinuationAndIndentation, Always
UseTab: Never
#SpacesInParentheses如果为真(true), 将会在“(”之后和“)”之前插入空格。
SpacesInParentheses: false
#SpacesInSquareBrackets如果为真(true),将会在“[”之后和“]”之前插入空格。
SpacesInSquareBrackets: false
Standard: c++17
TabWidth: 4
UseTab: Never