Skip to content

Commit 7bcc340

Browse files
committed
Update clang format
1 parent 678d831 commit 7bcc340

116 files changed

Lines changed: 1128 additions & 1056 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.clang-format‎

Lines changed: 246 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,252 @@
1-
# References:
2-
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
3-
# https://code.qt.io/cgit/qt/qt5.git/tree/_clang-format
4-
1+
Language: Cpp
52
BasedOnStyle: LLVM
6-
7-
Standard: c++20
8-
9-
# 指针和引用的对齐方式。
10-
# 可能的值有:
11-
# PAS_Left (在配置中: Left) 指针左对齐。
12-
# PAS_Right (在配置中: Right) 指针右对齐。
13-
# PAS_Middle (在配置中: Middle) 指针中间对齐。
14-
PointerAlignment: Right
15-
16-
# public/protected/private 等访问修饰符偏移量
173
AccessModifierOffset: -4
18-
19-
# 缩进长度
20-
IndentWidth: 4
21-
22-
# 连续空行的最大数
23-
MaxEmptyLinesToKeep: 999
24-
25-
# 在OC中的@property后面添加一个空格。例如:使用“@property (readonly)”而不是“@property(readonly)”
26-
ObjCSpaceAfterProperty: true
27-
28-
# OC块中所拍的字符数
29-
ObjCBlockIndentWidth: 4
30-
31-
# 取决于值, 语句“int f() { return 0; }”可以被放到一个单行。
32-
# 可能的值有:
33-
# SFS_None (在配置中: None) 从不合并方法或函数到单独的一行。
34-
# SFS_Empty (在配置中: Empty) 仅合并空的函数。
35-
# SFS_Inline (在配置中: Inline) 仅合并类中定义的方法或函数. 意味着 “empty”.
36-
# SFS_All (在配置中: All) 合并所有的方法适应单行.
37-
AllowShortFunctionsOnASingleLine: None
38-
39-
# 如果为真(true), 语句“if (a) return;” 能被放到单行。
40-
AllowShortIfStatementsOnASingleLine: false
41-
42-
# 如果为真(true), 对齐注释。
43-
AlignTrailingComments: true
44-
45-
# 如果为真,对齐连续的宏定义
46-
AlignConsecutiveMacros: true
47-
48-
# 如果为真(true),将会在“[”之后和“]”之前插入空格。
49-
SpacesInSquareBrackets: false
50-
51-
# 如果为真(true), 将会在“(”之后和“)”之前插入空格。
52-
SpacesInParentheses : false
53-
54-
# 如果为真(true), 校准连续的声明。
55-
# 这将会校准连续多行的声明的名字。这将会导致像下面这样的格式:
56-
# int aaaa = 12;
57-
# float b = 23;
58-
# std::string ccc = 23;
59-
AlignConsecutiveDeclarations: false
60-
61-
# 如果为真(true),连续调整多行
62-
# 这将会调整连续行中的分配操作符。这将会导致像下面这样的格式:
63-
# int aaaa = 12;
64-
# int b = 23;
65-
# int ccc = 23;
66-
AlignConsecutiveAssignments: false
67-
68-
# 如果为假(false),移除分配操作符(=)前空格。
69-
SpaceBeforeAssignmentOperators: true
70-
71-
# 如果为真(true), 将会在字面量容器中插入空格(例如 OC和Javascript的数组和字典字面量)。
72-
SpacesInContainerLiterals: false
73-
74-
# 缩进case标签
4+
AlignAfterOpenBracket: BlockIndent
5+
AlignArrayOfStructures: None
6+
AlignConsecutiveAssignments:
7+
Enabled: false
8+
AlignConsecutiveDeclarations:
9+
Enabled: false
10+
AlignConsecutiveMacros:
11+
Enabled: false
12+
AlignConsecutiveShortCaseStatements:
13+
Enabled: false
14+
AlignEscapedNewlines: Left
15+
AlignOperands: Align
16+
AlignTrailingComments:
17+
Kind: Never
18+
AllowAllArgumentsOnNextLine: true
19+
AllowAllParametersOfDeclarationOnNextLine: true
20+
AllowBreakBeforeNoexceptSpecifier: Never
21+
AllowShortBlocksOnASingleLine: Empty
22+
AllowShortCaseLabelsOnASingleLine: true
23+
AllowShortEnumsOnASingleLine: false
24+
AllowShortFunctionsOnASingleLine: All
25+
AllowShortIfStatementsOnASingleLine: Never
26+
AllowShortLambdasOnASingleLine: All
27+
AllowShortLoopsOnASingleLine: false
28+
AlwaysBreakAfterDefinitionReturnType: None
29+
AlwaysBreakAfterReturnType: None
30+
AlwaysBreakBeforeMultilineStrings: false
31+
AlwaysBreakTemplateDeclarations: MultiLine
32+
AttributeMacros:
33+
- __capability
34+
BinPackArguments: true
35+
BinPackParameters: true
36+
BitFieldColonSpacing: Both
37+
BraceWrapping:
38+
AfterCaseLabel: false
39+
AfterClass: false
40+
AfterControlStatement: Never
41+
AfterEnum: false
42+
AfterExternBlock: false
43+
AfterFunction: false
44+
AfterNamespace: false
45+
AfterObjCDeclaration: false
46+
AfterStruct: false
47+
AfterUnion: false
48+
BeforeCatch: false
49+
BeforeElse: false
50+
BeforeLambdaBody: false
51+
BeforeWhile: false
52+
IndentBraces: false
53+
SplitEmptyFunction: true
54+
SplitEmptyRecord: true
55+
SplitEmptyNamespace: true
56+
BreakAfterAttributes: Leave
57+
BreakAfterJavaFieldAnnotations: false
58+
BreakArrays: true
59+
BreakBeforeBinaryOperators: None
60+
BreakBeforeConceptDeclarations: Always
61+
BreakBeforeBraces: Attach
62+
BreakBeforeInlineASMColon: OnlyMultiline
63+
BreakBeforeTernaryOperators: true
64+
BreakConstructorInitializers: BeforeColon
65+
BreakInheritanceList: BeforeColon
66+
BreakStringLiterals: true
67+
ColumnLimit: 0
68+
CommentPragmas: '^ IWYU pragma:'
69+
CompactNamespaces: false
70+
ConstructorInitializerIndentWidth: 4
71+
ContinuationIndentWidth: 4
72+
Cpp11BracedListStyle: true
73+
DerivePointerAlignment: false
74+
DisableFormat: false
75+
EmptyLineAfterAccessModifier: Never
76+
EmptyLineBeforeAccessModifier: LogicalBlock
77+
ExperimentalAutoDetectBinPacking: false
78+
FixNamespaceComments: false
79+
ForEachMacros: [foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE]
80+
IfMacros:
81+
- KJ_IF_MAYBE
82+
IncludeBlocks: Regroup
83+
IncludeCategories:
84+
# Local headers
85+
- Regex: '^".*\.h"$'
86+
Priority: -999
87+
# Qt public
88+
- Regex: '^<(Q[a-zA-Z0-9_]+|qt_[a-zA-Z0-9_]+\.h|qqml_[a-zA-Z0-9_]+\.h)>$'
89+
Priority: 201
90+
# Qt qpa
91+
- Regex: '^<qpa/[a-zA-Z0-9_]+\.h>$'
92+
Priority: 202
93+
# Qt private
94+
- Regex: '^<Qt[a-zA-Z0-9_/]+_p\.h>$'
95+
Priority: 203
96+
# Windows platform-specific
97+
- Regex: '^<[a-zA-Z0-9_]+\.h>$'
98+
Priority: 1
99+
# C++ standard library
100+
- Regex: '^<[a-z0-9_]+>$'
101+
Priority: 2
102+
# Boost
103+
- Regex: '^<boost/$'
104+
Priority: 101
105+
# ChorusKit (3rdparty)
106+
- Regex: '^<CoreApi/'
107+
Priority: 1001
108+
# ExtensionSystem (3rdparty)
109+
- Regex: '^<extensionsystem/'
110+
Priority: 1002
111+
# opendspx (3rdparty)
112+
- Regex: '^<opendspx/'
113+
Priority: 1003
114+
# QActionKit (3rdparty)
115+
- Regex: '^<QAK.*/'
116+
Priority: 1004
117+
# QWindowKit (3rdparty)
118+
- Regex: '^<QWK.*/'
119+
Priority: 1005
120+
# SVSCraft (3rdparty)
121+
- Regex: '^<SVSCraft.*/'
122+
Priority: 1006
123+
# ScopicFlow (3rdparty)
124+
- Regex: '^<ScopicFlow.*/'
125+
Priority: 1007
126+
# TALCS (3rdparty)
127+
- Regex: '^<Talcs.*/'
128+
Priority: 1008
129+
# DSPX Model (application)
130+
- Regex: '^<dspxmodel/'
131+
Priority: 2001
132+
# loadapi (application)
133+
- Regex: '^<loadapi/'
134+
Priority: 2002
135+
# UIShell (application)
136+
- Regex: '^<uishell/'
137+
Priority: 2003
138+
# Core (plugin)
139+
- Regex: '^<coreplugin/'
140+
Priority: 3001
141+
IndentAccessModifiers: false
142+
IndentCaseBlocks: false
75143
IndentCaseLabels: true
76-
77-
# 如果表达式中包含函数调用,并且函数调用因为表达式太长被放到了下一行,是否缩进
78-
IndentWrappedFunctionNames: true
79-
80-
# 如果为真(true), 保持块的起始空行。
81-
# true: false:
82-
# if (foo) { vs. if (foo) {
83-
# bar();
84-
# bar(); }
85-
# }
144+
IndentExternBlock: AfterExternBlock
145+
IndentGotoLabels: true
146+
IndentPPDirectives: AfterHash
147+
IndentRequiresClause: true
148+
IndentWidth: 4
149+
IndentWrappedFunctionNames: false
150+
InsertBraces: false
151+
InsertNewlineAtEOF: true
152+
InsertTrailingCommas: None
153+
IntegerLiteralSeparator:
154+
Binary: 0
155+
BinaryMinDigits: 0
156+
Decimal: 0
157+
DecimalMinDigits: 0
158+
Hex: 0
159+
HexMinDigits: 0
160+
JavaScriptQuotes: Leave
161+
JavaScriptWrapImports: true
86162
KeepEmptyLinesAtTheStartOfBlocks: true
87-
88-
# 允许所有参数都被放在下一行
89-
AllowAllParametersOfDeclarationOnNextLine: false
90-
91-
# 使用C风格强制类型转换后,是否在中间添加一个空格
92-
SpaceAfterCStyleCast: true
93-
94-
# 在模板定义后换行
95-
AlwaysBreakTemplateDeclarations: Yes
96-
97-
# Tab长度
163+
KeepEmptyLinesAtEOF: true
164+
LambdaBodyIndentation: Signature
165+
LineEnding: LF
166+
MacroBlockBegin: ''
167+
MacroBlockEnd: ''
168+
MaxEmptyLinesToKeep: 1
169+
NamespaceIndentation: All
170+
ObjCBinPackProtocolList: Auto
171+
ObjCBlockIndentWidth: 2
172+
ObjCBreakBeforeNestedBlockParam: true
173+
ObjCSpaceAfterProperty: false
174+
ObjCSpaceBeforeProtocolList: true
175+
PackConstructorInitializers: BinPack
176+
PenaltyBreakAssignment: 2
177+
PenaltyBreakBeforeFirstCallParameter: 19
178+
PenaltyBreakComment: 300
179+
PenaltyBreakFirstLessLess: 120
180+
PenaltyBreakOpenParenthesis: 0
181+
PenaltyBreakString: 1000
182+
PenaltyBreakTemplateDeclaration: 10
183+
PenaltyExcessCharacter: 1000000
184+
PenaltyIndentedWhitespace: 0
185+
PenaltyReturnTypeOnItsOwnLine: 60
186+
PointerAlignment: Right
187+
PPIndentWidth: -1
188+
QualifierAlignment: Leave
189+
ReferenceAlignment: Pointer
190+
ReflowComments: false
191+
RemoveBracesLLVM: false
192+
RemoveParentheses: Leave
193+
RemoveSemicolon: false
194+
RequiresClausePosition: OwnLine
195+
RequiresExpressionIndentation: OuterScope
196+
SeparateDefinitionBlocks: Leave
197+
ShortNamespaceLines: 1
198+
SortIncludes: CaseSensitive
199+
SortJavaStaticImport: Before
200+
SortUsingDeclarations: LexicographicNumeric
201+
SpaceAfterCStyleCast: false
202+
SpaceAfterLogicalNot: false
203+
SpaceAfterTemplateKeyword: true
204+
SpaceAroundPointerQualifiers: After
205+
SpaceBeforeAssignmentOperators: true
206+
SpaceBeforeCaseColon: false
207+
SpaceBeforeCpp11BracedList: false
208+
SpaceBeforeCtorInitializerColon: true
209+
SpaceBeforeInheritanceColon: true
210+
SpaceBeforeJsonColon: false
211+
SpaceBeforeParens: ControlStatements
212+
SpaceBeforeParensOptions:
213+
AfterControlStatements: true
214+
AfterForeachMacros: true
215+
AfterFunctionDefinitionName: false
216+
AfterFunctionDeclarationName: false
217+
AfterIfMacros: true
218+
AfterOverloadedOperator: false
219+
AfterRequiresInClause: false
220+
AfterRequiresInExpression: false
221+
BeforeNonEmptyParentheses: false
222+
SpaceBeforeRangeBasedForLoopColon: true
223+
SpaceBeforeSquareBrackets: false
224+
SpaceInEmptyBlock: false
225+
SpacesBeforeTrailingComments: 1
226+
SpacesInAngles: Never
227+
SpacesInContainerLiterals: true
228+
SpacesInLineCommentPrefix:
229+
Minimum: 1
230+
Maximum: -1
231+
SpacesInParens: Never
232+
SpacesInParensOptions:
233+
InCStyleCasts: false
234+
InConditionalStatements: false
235+
InEmptyParentheses: false
236+
Other: false
237+
SpacesInSquareBrackets: false
238+
Standard: Latest
239+
StatementAttributeLikeMacros:
240+
- Q_EMIT
241+
StatementMacros:
242+
- Q_UNUSED
243+
- QT_REQUIRE_VERSION
98244
TabWidth: 4
99-
100-
# 是否使用Tab
101245
UseTab: Never
102-
103-
# 在括号后对齐参数
104-
# someLongFunction(argument1,
105-
# argument2);
106-
AlignAfterOpenBracket: Align
107-
108-
# 名字空间内部缩进
109-
NamespaceIndentation: All
110-
111-
# 一行最长列数
112-
ColumnLimit: 999
113-
114-
# 按层次缩进宏定义
115-
IndentPPDirectives: AfterHash
116-
117-
# 预处理语句缩进为 2
118-
PPIndentWidth: 2
119-
120-
# 数组元素对齐
121-
AlignArrayOfStructures: Left
122-
123-
# 不对头文件排序
124-
SortIncludes: Never
125-
126-
FixNamespaceComments: false
127-
128-
StatementMacros: ['__qas_attr__', '__qas_exclude__', '__qas_include__']
129-
130-
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ]
246+
VerilogBreakBetweenInstancePorts: true
247+
WhitespaceSensitiveMacros:
248+
- BOOST_PP_STRINGIZE
249+
- CF_SWIFT_NAME
250+
- NS_SWIFT_NAME
251+
- PP_STRINGIZE
252+
- STRINGIZE

0 commit comments

Comments
 (0)