Skip to content

Commit bb1f4e7

Browse files
authored
Merge pull request #192 from MRNIU/main
面向 AI 的重构
1 parent 4c86b9d commit bb1f4e7

855 files changed

Lines changed: 56751 additions & 97644 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: 3 additions & 390 deletions
Original file line numberDiff line numberDiff line change
@@ -1,395 +1,8 @@
1-
# This file is a part of Simple-XX/SimpleKernel
2-
# (https://github.com/Simple-XX/SimpleKernel).
3-
#
4-
# CMakeLists.txt for Simple-XX/SimpleKernel.
1+
# Copyright The SimpleKernel Contributors
52

63
---
74
# @version clang-format version 15
85
# @see https://clang.llvm.org/docs/ClangFormatStyleOptions.html
9-
10-
# 访问说明符 public/private 的偏移,与类对齐
11-
AccessModifierOffset: -4
12-
# ( 后的参数对齐,与 ( 对齐
13-
AlignAfterOpenBracket: Align
14-
# 结构体初始化对齐,右对齐
15-
AlignArrayOfStructures: Right
16-
# 连续赋值对齐
17-
AlignConsecutiveAssignments:
18-
# 允许
19-
Enabled: true
20-
# 忽略空行
21-
AcrossEmptyLines: true
22-
# 忽略注释
23-
AcrossComments: true
24-
# 忽略混合运算符
25-
AlignCompound: true
26-
# 填充运算符
27-
PadOperators: true
28-
# 位域对齐
29-
AlignConsecutiveBitFields:
30-
# 允许
31-
Enabled: true
32-
# 忽略空行
33-
AcrossEmptyLines: true
34-
# 忽略注释
35-
AcrossComments: true
36-
# 忽略混合运算符
37-
AlignCompound: true
38-
# 填充运算符
39-
PadOperators: true
40-
# 连续声明对齐,忽略空行/注释
41-
AlignConsecutiveDeclarations:
42-
# 允许
43-
Enabled: true
44-
# 忽略空行
45-
AcrossEmptyLines: true
46-
# 忽略注释
47-
AcrossComments: true
48-
# 忽略混合运算符
49-
AlignCompound: true
50-
# 填充运算符
51-
PadOperators: true
52-
# 连续宏定义对齐,忽略空行/注释
53-
AlignConsecutiveMacros:
54-
# 允许
55-
Enabled: true
56-
# 忽略空行
57-
AcrossEmptyLines: true
58-
# 忽略注释
59-
AcrossComments: true
60-
# 忽略混合运算符
61-
AlignCompound: true
62-
# 填充运算符
63-
PadOperators: true
64-
# 换行符号左对齐
65-
AlignEscapedNewlines: Left
66-
# 操作符对齐,与 BreakBeforeBinaryOperators 共同生效
67-
AlignOperands: AlignAfterOperator
68-
# 行后注释对齐
69-
AlignTrailingComments: true
70-
# 尽量将函数调用/初始化的所有参数放在同一行,禁用
71-
AllowAllArgumentsOnNextLine: false
72-
# 尽量将函数声明的参数放在同一行
73-
AllowAllParametersOfDeclarationOnNextLine: true
74-
# 将 while (true) {} 中的 {} 合并为一行,禁用
75-
AllowShortBlocksOnASingleLine: Never
76-
# 将 switch case: 中的 case: 合并为一行,禁用
77-
AllowShortCaseLabelsOnASingleLine: false
78-
# 将枚举类型合并为一行,禁用
79-
AllowShortEnumsOnASingleLine: false
80-
# 将短函数合并为一行,禁用
81-
AllowShortFunctionsOnASingleLine: None
82-
# 将短语句合并为一行,禁用
83-
AllowShortIfStatementsOnASingleLine: Never
84-
# 将 lambda 表达式合并为一行,禁用
85-
AllowShortLambdasOnASingleLine: None
86-
# 将短循环合并为一行,禁用
87-
AllowShortLoopsOnASingleLine: false
88-
# 将在返回类型后换行,禁用
89-
AlwaysBreakAfterReturnType: None
90-
# 将在多行字符串前换行,禁用
91-
AlwaysBreakBeforeMultilineStrings: false
92-
# 在模版声明后换行
93-
AlwaysBreakTemplateDeclarations: Yes
94-
# 编译器属性排除,不会参与格式化
95-
AttributeMacros: [ '__capability',
96-
'__output',
97-
'__ununsed',
98-
'[[maybe_unused]]' ]
99-
100-
# 尽量将函数调用的参数放在同一行
101-
BinPackArguments: true
102-
# 尽量将函数声明的参数放在同一行
103-
BinPackParameters: true
104-
# 在位域声明的 : 前后都加空格
105-
BitFieldColonSpacing: Both
106-
# 大括号换行设置
107-
BraceWrapping:
108-
# 在 case 后换行,禁用
109-
AfterCaseLabel: false
110-
# 在 class 后换行,禁用
111-
AfterClass: false
112-
# 在控制语句后换行,禁用
113-
AfterControlStatement: Never
114-
# 在 enum 后换行,禁用
115-
AfterEnum: false
116-
# 在函数定义后换行,禁用
117-
AfterFunction: false
118-
# 在 namespace 后换行,禁用
119-
AfterNamespace: false
120-
# 在结构体后换行,禁用
121-
AfterStruct: false
122-
# 在联合体后换行,禁用
123-
AfterUnion: false
124-
# 在 extern 后换行,禁用
125-
AfterExternBlock: false
126-
# 在 catch 后换行,禁用
127-
BeforeCatch: false
128-
# 在 else 前换行
129-
BeforeElse: true
130-
# 在 lambda 后换行,禁用
131-
BeforeLambdaBody: false
132-
# 在 while 前换行,禁用
133-
BeforeWhile: false
134-
# 换行缩进括号,禁用
135-
IndentBraces: false
136-
# 空函数的大括号换行
137-
SplitEmptyFunction: true
138-
# 空 class/struct/union 的大括号换行
139-
SplitEmptyRecord: true
140-
# 空 namespace 的大括号换行
141-
SplitEmptyNamespace: true
142-
# 在二元操作符前换行
143-
BreakBeforeBinaryOperators: All
144-
# 在大括号前换行,使用自定义规则,在 BraceWrapping 中规定
145-
BreakBeforeBraces: Custom
146-
# 在 concept(c++20) 前换行
147-
BreakBeforeConceptDeclarations: Always
148-
# 在三元操作符前换行
149-
BreakBeforeTernaryOperators: true
150-
# 构造函数初始化列表在冒号 : 前,逗号 , 后换行
151-
BreakConstructorInitializers: BeforeColon
152-
# class 继承列表在冒号 : 前,逗号 , 后换行
153-
BreakInheritanceList: BeforeColon
154-
# 允许将字符串切割
155-
BreakStringLiterals: true
156-
# 最大列数
157-
ColumnLimit: 80
158-
# 特殊注释的正则表达式,不会进行格式化
159-
CommentPragmas: '^ NO_STYLE:'
160-
# 将多个 namespace 合并为一行,禁用
161-
CompactNamespaces: false
162-
# 构造函数的初始化列表/继承列表的缩进宽度
163-
ConstructorInitializerIndentWidth: 4
164-
# 续行的缩进宽度
165-
ContinuationIndentWidth: 2
166-
# 去除 C++11 的列表初始化的大括号 { 后和 } 前的空格,禁用
167-
Cpp11BracedListStyle: false
168-
# 分析文件使用最多的换行符并应用到整个文件,
169-
# 只有当无法得到结论时才会使用 UseCRLF,禁用
170-
DeriveLineEnding: true
171-
# 分析文件使用最多的指针/引用的对齐方式并应用到整个文件,
172-
# 只有当无法得到结论时才会使用 PointerAlignment,禁用
173-
DerivePointerAlignment: false
174-
# 关闭格式化,禁用
175-
DisableFormat: false
176-
# 访问描述符后的空行,只保留 MaxEmptyLinesToKeep 指定的行数
177-
EmptyLineAfterAccessModifier: Leave
178-
# 访问描述符前的空行,始终保留,除非是 class/struct 的开始
179-
EmptyLineBeforeAccessModifier: Always
180-
# 在命名空间结束后添加注释,与 ShortNamespaceLines 共同生效
181-
FixNamespaceComments: true
182-
# for-each 宏,作为循环语句进行格式化
183-
ForEachMacros: [ 'RANGES_FOR', 'FOREACH' ]
184-
185-
# if 宏,作为条件语句进行格式化
186-
IfMacros: [ 'IF' ]
187-
# 将 #include 分块,规则由 IncludeCategories 指定,暂未使用
188-
#IncludeBlocks: Regroup
189-
# 将 #include 分块,保留原有分块
190-
IncludeBlocks: Preserve
191-
# 对 #include 进行排序,匹配了某正则表达式的 #include 拥有对应的优先级,
192-
# 优先级越小排序越靠前,匹配不到的则默认优先级为 INT_MAX,暂未使用
193-
IncludeCategories:
194-
# 正则
195-
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
196-
# 优先级
197-
Priority: 2
198-
# 排序优先级,默认与 Priority 相同
199-
SortPriority: 2
200-
# 大小写敏感
201-
CaseSensitive: true
202-
- Regex: '^((<|")(gtest|gmock|isl|json)/)'
203-
Priority: 3
204-
CaseSensitive: true
205-
- Regex: '<[[:alnum:].]+>'
206-
Priority: 4
207-
CaseSensitive: true
208-
- Regex: '.*'
209-
Priority: 1
210-
SortPriority: 0
211-
CaseSensitive: true
212-
# 判断头文件是否为相关的头文件,用于排序
213-
# 如 a.cpp 与 a.h,设置为 a.cpp/a_test.cpp
214-
IncludeIsMainRegex: '(_test)?$'
215-
# 判断头文件是否包含实现,用于排序
216-
IncludeIsMainSourceRegex: '(*\.hpp)$'
217-
# 访问控制符缩进,禁用
218-
IndentAccessModifiers: false
219-
# case 块缩进,禁用
220-
IndentCaseBlocks: false
221-
# case 标签缩进
222-
IndentCaseLabels: true
223-
# extern 块缩进,与 BraceWrapping.AfterExternBlock 共同生效
224-
IndentExternBlock: AfterExternBlock
225-
# 缩进 goto 标签,禁用
226-
IndentGotoLabels: false
227-
# 缩进预处理,在 # 后缩进
228-
IndentPPDirectives: AfterHash
229-
# 缩进 requires
230-
IndentRequiresClause: true
231-
# 缩进宽度
232-
IndentWidth: 4
233-
# 函数返回类型换行时,缩进函数声明/函数定义的函数名,禁用
234-
IndentWrappedFunctionNames: false
235-
# 自动插入大括号
236-
InsertBraces: true
237-
# 保留在块开始处的空行,禁用
238-
KeepEmptyLinesAtTheStartOfBlocks: false
239-
# lambda 表达式函数体缩进
240-
LambdaBodyIndentation: OuterScope
241-
# 语言,设置语言为 c++
242-
Language: Cpp
243-
244-
# 开始一个块的宏的正则表达式
245-
MacroBlockBegin: "^MACRO_BEGIN|NS_TABLE_HEAD$"
246-
# 结束一个块的宏的正则表达式
247-
MacroBlockEnd: "^MACRO_END|NS_TABLE_.*_END$"
248-
# 最大连续空行
249-
MaxEmptyLinesToKeep: 1
250-
# namespace 缩进,禁用
251-
NamespaceIndentation: None
252-
# namespace 宏
253-
NamespaceMacros: [ 'NAMESPACE' ]
254-
# 预处理缩进,-1 表示使用默认值 IndentWidth
255-
PPIndentWidth: -1
256-
# 如果构造函数的初始化列表超过一行则换行
257-
PackConstructorInitializers: NextLine
258-
259-
# 有些情况下你会觉得怎么排版都达不到完美,
260-
# 只能各方面妥协一下(例如你限定了行宽,但注释想放宽松点允许超一些)。
261-
# penalty 简单来说就是給每一次“违规”设定一个罚分,
262-
# clang-format 帮你选择最终吃到的总罚分比较少的策略。
263-
# 在赋值前后换行时的罚分
264-
# @see https://www.zhihu.com/question/438473572/answer/1668773325
265-
# 在赋值前后打断的罚分
266-
PenaltyBreakAssignment: 2
267-
# 在函数调用 fun( 后打断的罚分
268-
PenaltyBreakBeforeFirstCallParameter: 19
269-
# 在注释中换行的罚分
270-
PenaltyBreakComment: 300
271-
# 在第一个 << 点打断的罚分
272-
PenaltyBreakFirstLessLess: 120
273-
# 在 ( 后打断的罚分
274-
PenaltyBreakOpenParenthesis: 100
275-
# 在字符串常量中换行的罚分
276-
PenaltyBreakString: 1000
277-
# 在模版声明后打断的罚分
278-
PenaltyBreakTemplateDeclaration: 10
279-
# 注释的每个字符超出 ColumnLimit 的罚分
280-
PenaltyExcessCharacter: 1000000
281-
# 每个空格缩进的罚分,
282-
# counted relative to leading non-whitespace column
283-
PenaltyIndentedWhitespace: 0
284-
# 函数返回类型单独成行的罚分
285-
PenaltyReturnTypeOnItsOwnLine: 0
286-
# 指针和引用对齐,左对齐
287-
PointerAlignment: Left
288-
# 修饰符对齐,由 QualifierOrder 指定
289-
QualifierAlignment: Custom
290-
# 修饰符顺序
291-
QualifierOrder: [ 'inline', 'static', 'const', 'volatile','type' ]
292-
# 将字符串格式化,与 ProtocolBuffers 配合使用,未使用
293-
RawStringFormats:
294-
- Language: Cpp
295-
BasedOnStyle: InheritParentConfig
296-
Delimiters: [ pb ]
297-
# 引用对齐,与 PointerAlignment 相同
298-
ReferenceAlignment: Pointer
299-
# 重新排版注释
300-
ReflowComments: true
301-
# requires 位置,单独成行
302-
RequiresClausePosition: OwnLine
303-
# 在定义块之间添加空行,总是添加
304-
SeparateDefinitionBlocks: Always
305-
# 设置短 namespace 长度,0 表示将所有 namespace 视为 short namespace
306-
ShortNamespaceLines: 0
307-
# 排序 #include,按照字母序
308-
SortIncludes: CaseInsensitive
309-
# 排序 using 声明
310-
SortUsingDeclarations: true
311-
# 在 C 风格类型转换后添加空格,禁用
312-
SpaceAfterCStyleCast: false
313-
# 在逻辑非 ! 后添加空格,禁用
314-
SpaceAfterLogicalNot: false
315-
# 在 template 后添加空格
316-
SpaceAfterTemplateKeyword: true
317-
# 在指针修饰符周围添加空格,使用 PointerAlignment
318-
SpaceAroundPointerQualifiers: Default
319-
# 在赋值运算符之前添加空格
320-
SpaceBeforeAssignmentOperators: true
321-
# 在 case 的 : 前添加空格,禁用
322-
SpaceBeforeCaseColon: false
323-
# 在 c++11 大括号初始化前添加空格
324-
SpaceBeforeCpp11BracedList: true
325-
# 在构造函数初始化列表 : 前添加空格
326-
SpaceBeforeCtorInitializerColon: true
327-
# 在继承 : 前添加空格
328-
SpaceBeforeInheritanceColon: true
329-
# 在 ( 前添加空格,由 SpaceBeforeParensOptions 指定
330-
SpaceBeforeParens: Custom
331-
# 在 ( 前添加空格的规则
332-
SpaceBeforeParensOptions:
333-
# 在控制语句后添加
334-
AfterControlStatements: true
335-
# 在 for-each 宏后添加,禁用
336-
AfterForeachMacros: false
337-
# 在函数声明后添加,禁用
338-
AfterFunctionDeclarationName: false
339-
# 在函数定义后添加,禁用
340-
AfterFunctionDefinitionName: false
341-
# 在 if 宏后添加,禁用
342-
AfterIfMacros: false
343-
# 在重载运算符后添加,禁用
344-
AfterOverloadedOperator: false
345-
# 在 requires 后添加
346-
AfterRequiresInClause: true
347-
# 在表达式中的 requires 后添加,禁用
348-
AfterRequiresInExpression: false
349-
# 在非空的 () 前添加,禁用
350-
BeforeNonEmptyParentheses: false
351-
# 在范围 for 循环 : 前添加空格
352-
SpaceBeforeRangeBasedForLoopColon: true
353-
# 在 [ 前添加空格,禁用
354-
SpaceBeforeSquareBrackets: false
355-
# 在空 {} 中添加空格
356-
SpaceInEmptyBlock: true
357-
# 在空的圆括号中添加空格,禁用
358-
SpaceInEmptyParentheses: false
359-
# 在行后注释前添加空格(只适用于 //)
360-
SpacesBeforeTrailingComments: 4
361-
# 在尖括号的 < 后和 > 前添加空格,禁用
362-
SpacesInAngles: Never
363-
# 在 C 风格类型转换的括号中添加空格,禁用
364-
SpacesInCStyleCastParentheses: false
365-
# 在条件判断中 ( 后 ) 前添加空格,禁用
366-
SpacesInConditionalStatement: false
367-
# 在容器字面量中添加空格
368-
SpacesInContainerLiterals: true
369-
# 行注释前缀中的空格
370-
SpacesInLineCommentPrefix:
371-
# 最大值
372-
Maximum: 1
373-
# 最小值
374-
Minimum: 1
375-
# 在 ( 后和 ) 前添加空格,禁用
376-
SpacesInParentheses: false
377-
# 在 [ 后和 ] 前添加空格,lamda 表达式和未指明大小的数组的声明不受影响,禁用
378-
SpacesInSquareBrackets: false
379-
# cpp 标准,使用最新支持的
380-
Standard: Latest
381-
# 需要识别为宏的代码块前缀
382-
StatementAttributeLikeMacros: [ ]
383-
# 需要解释为完整代码段的宏
384-
StatementMacros: [ ]
385-
# tab 宽度,8 个空格
386-
TabWidth: 8
387-
# 需要识别为宏,而不是函数调用的宏
388-
TypenameMacros: [ ]
389-
# 使用 \r\n 换行符,与 DeriveLineEnding 共同生效,禁用
390-
UseCRLF: false
391-
# 使用 tab,禁用
392-
UseTab: Never
393-
# 对空格敏感的宏
394-
WhitespaceSensitiveMacros: [ ]
6+
# 使用 Google 规范
7+
BasedOnStyle: Google
3958
...

0 commit comments

Comments
 (0)