Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
3536 commits
Select commit Hold shift + click to select a range
87e5c06
3rd: update
MRNIU Jan 19, 2026
09ec821
Merge branch 'boot' into memory
MRNIU Jan 19, 2026
a0a5ef1
Merge branch 'memory' into interrupt
MRNIU Jan 19, 2026
cbc3b7e
Merge branch 'interrupt' into thread
MRNIU Jan 19, 2026
c8b0ccc
feat: sk_unordered_map
MRNIU Jan 19, 2026
d53c996
feat: sk_unordered_map
MRNIU Jan 19, 2026
b4ff62e
refactor: TaskManager
MRNIU Jan 19, 2026
33df85f
feat: fifo_scheduler
MRNIU Jan 19, 2026
3478ffc
feat: rr_scheduler
MRNIU Jan 19, 2026
103b89c
feat: rr_scheduler
MRNIU Jan 19, 2026
3bd8ed5
feat: CfsScheduler
MRNIU Jan 19, 2026
2e6f8d1
feat: sleep exit tick_update
MRNIU Jan 19, 2026
f5e0ebd
feat: exit
MRNIU Jan 19, 2026
850dfc5
feat: exit
MRNIU Jan 19, 2026
9f2eca5
feat: Sleep
MRNIU Jan 19, 2026
c587de5
fix: LockGuard
MRNIU Jan 19, 2026
bc40382
feat TickUpdate
MRNIU Jan 19, 2026
63c26ba
feat TickUpdate
MRNIU Jan 19, 2026
74adb5c
feat TickUpdate
MRNIU Jan 19, 2026
3e01087
feat TickUpdate
MRNIU Jan 19, 2026
ece53a5
fix: TaskControlBlock
MRNIU Jan 19, 2026
29b175c
fix: TaskControlBlock
MRNIU Jan 19, 2026
d8a735d
fix: TaskControlBlock
MRNIU Jan 19, 2026
4838a9d
fix: TaskControlBlock
MRNIU Jan 19, 2026
c885409
feat: thread working fine
MRNIU Jan 19, 2026
81b2a04
3rd: update
MRNIU Jan 19, 2026
5e49142
Merge branch 'boot' into memory
MRNIU Jan 19, 2026
5eb0e9b
Merge branch 'memory' into interrupt
MRNIU Jan 19, 2026
6b09e8b
Merge branch 'interrupt' into thread
MRNIU Jan 19, 2026
21fdab6
test: update ut
MRNIU Jan 20, 2026
971f66b
test: update ut
MRNIU Jan 20, 2026
7ce7268
fix: st
MRNIU Jan 20, 2026
1e36452
Merge branch 'interrupt' into thread
MRNIU Jan 20, 2026
6962291
fix: st
MRNIU Jan 20, 2026
6b5af5f
refactor: timer
MRNIU Jan 20, 2026
b95832d
refactor: timer
MRNIU Jan 20, 2026
cc68c1b
refactor: timer
MRNIU Jan 20, 2026
be97087
feat: interval
MRNIU Jan 20, 2026
dfba78a
feat: interval
MRNIU Jan 20, 2026
ed629e2
Merge branch 'boot' into memory
MRNIU Jan 20, 2026
a545706
feat: interval
MRNIU Jan 20, 2026
eaee49e
refactor: interrupt
MRNIU Jan 20, 2026
fe05876
refactor: interrupt
MRNIU Jan 20, 2026
b90211f
refactor: interrupt
MRNIU Jan 20, 2026
ea2ea02
refactor: interrupt
MRNIU Jan 20, 2026
cbeab74
refactor: interrupt
MRNIU Jan 20, 2026
7b5e96a
refactor: interrupt
MRNIU Jan 20, 2026
e32da9f
refactor: interrupt
MRNIU Jan 20, 2026
22cd960
refactor: interrupt
MRNIU Jan 20, 2026
c04650d
refactor: interrupt
MRNIU Jan 20, 2026
54c8b44
refactor: TrapContext
MRNIU Jan 20, 2026
20eebb7
refactor: TrapContext
MRNIU Jan 20, 2026
fc9e6ee
refactor: TrapContext
MRNIU Jan 20, 2026
ea4dd10
Merge branch 'interrupt' into thread
MRNIU Jan 20, 2026
7aac579
refactor: TrapContext
MRNIU Jan 20, 2026
0aa428a
3rd: update
MRNIU Jan 20, 2026
4dc774d
Merge branch 'boot' into memory
MRNIU Jan 20, 2026
49c1e04
Merge branch 'memory' into interrupt
MRNIU Jan 20, 2026
eee7282
Merge branch 'interrupt' into thread
MRNIU Jan 20, 2026
a8d2ba0
refactor: interrupt
MRNIU Jan 20, 2026
e4e495b
refactor: interrupt
MRNIU Jan 20, 2026
9fc4b9b
refactor: interrupt
MRNIU Jan 20, 2026
c0f295b
Merge branch 'interrupt' into thread
MRNIU Jan 20, 2026
803a057
refactor: thread
MRNIU Jan 20, 2026
514cdd4
refactor: main
MRNIU Jan 20, 2026
ae32cc3
refactor: main
MRNIU Jan 20, 2026
967cda2
Merge branch 'memory' into interrupt
MRNIU Jan 20, 2026
f1d8399
Merge branch 'interrupt' into thread
MRNIU Jan 20, 2026
a52d760
feat: thread on aarch64
MRNIU Jan 20, 2026
4cdb855
feat: add x86_64 switch
MRNIU Jan 20, 2026
1d8463b
Merge branch 'interrupt' into thread
MRNIU Jan 20, 2026
069e9d6
feat: add x86_64 switch
MRNIU Jan 20, 2026
4378b86
Merge branch 'interrupt' into thread
MRNIU Jan 20, 2026
30801eb
feat: block and wakeup
MRNIU Jan 20, 2026
5c1a7a7
refactor: thread_contral_block
MRNIU Jan 21, 2026
23e04f2
refactor: thread_contral_block
MRNIU Jan 21, 2026
53f43ee
feat: task_table_
MRNIU Jan 21, 2026
6bd816d
refactor: thread_contral_block
MRNIU Jan 21, 2026
d132739
refactor: thread_contral_block
MRNIU Jan 21, 2026
c4dcae8
refactor: thread_contral_block
MRNIU Jan 21, 2026
faeace3
feat: DestroyPageDirectory ClonePageDirectory
MRNIU Jan 21, 2026
49bab11
test: working on virtual_memory test
MRNIU Jan 21, 2026
7c655e4
feat: SIMPLEKERNEL_EARLY_CONSOLE_BASE
MRNIU Jan 21, 2026
8468f23
Merge branch 'boot' into memory
MRNIU Jan 21, 2026
0388035
feat: SIMPLEKERNEL_EARLY_CONSOLE_BASE
MRNIU Jan 21, 2026
f8b052d
Merge branch 'boot' into memory
MRNIU Jan 21, 2026
c1c524e
fix: update klog
MRNIU Jan 21, 2026
562cc0c
fix: update klog
MRNIU Jan 21, 2026
9292094
test: update ut
MRNIU Jan 21, 2026
7d7de74
Merge branch 'boot' into memory
MRNIU Jan 21, 2026
f29d6ee
test: update ut
MRNIU Jan 21, 2026
6478f30
Merge branch 'memory' into interrupt
MRNIU Jan 21, 2026
d0465ed
Merge branch 'interrupt' into thread
MRNIU Jan 21, 2026
7bd0c05
test: update ut
MRNIU Jan 21, 2026
ee91e53
test: update ut
MRNIU Jan 22, 2026
1be8e1c
Merge branch 'memory' into interrupt
MRNIU Jan 22, 2026
b67b548
Merge branch 'interrupt' into thread
MRNIU Jan 22, 2026
aab6472
feat: resource id
MRNIU Jan 22, 2026
e57502c
feat: thread_group
MRNIU Jan 22, 2026
304fc74
feat: GetThreadGroup
MRNIU Jan 22, 2026
ebd8d2c
feat: block for ResourceId
MRNIU Jan 22, 2026
6225e53
feat: wakeup for ResourceId
MRNIU Jan 22, 2026
9e0d25e
feat: thread group for exit
MRNIU Jan 22, 2026
bad0e68
test: update ut
MRNIU Jan 22, 2026
804f4be
test: update ut
MRNIU Jan 22, 2026
e83a86e
test: update st
MRNIU Jan 22, 2026
208d01f
feat: clone and wait
MRNIU Jan 22, 2026
28af236
feat: clone and wait
MRNIU Jan 22, 2026
be39b18
feat: clone
MRNIU Jan 22, 2026
677c2d2
3rd: update
MRNIU Jan 22, 2026
db22a38
test: update st, need refactor
MRNIU Jan 22, 2026
6039d36
test: update ut
MRNIU Jan 22, 2026
0cf4d2a
test: update ut
MRNIU Jan 22, 2026
558ae40
feat: sys_futex sys_clone sys_gettid sys_set_tid_address
MRNIU Jan 22, 2026
d26c796
feat: sys_fork
MRNIU Jan 22, 2026
2df2275
feat: sys_fork
MRNIU Jan 23, 2026
a6b1bbc
fix: use auto for
MRNIU Jan 27, 2026
57b00a6
feat: resource kInterrupt
MRNIU Jan 28, 2026
370455e
feat: tcb is_interrupt_thread
MRNIU Jan 28, 2026
523fc63
feat: interrupt_work_queues_ interrupt_threads_
MRNIU Jan 28, 2026
f4c2748
refactor: tcb
MRNIU Jan 28, 2026
8937795
feat: working on threading interrupt
MRNIU Jan 28, 2026
a64ccba
refactor: rename locl->Lock
MRNIU Jan 28, 2026
2a5f57a
Merge branch 'boot' into memory
MRNIU Jan 28, 2026
4b725a4
Merge branch 'memory' into interrupt
MRNIU Jan 28, 2026
86a0631
style: update
MRNIU Jan 28, 2026
d29154c
style: update
MRNIU Jan 28, 2026
c39c743
Merge branch 'boot' into memory
MRNIU Jan 28, 2026
d7f1c88
style: update
MRNIU Jan 28, 2026
c7e1779
Merge branch 'memory' into interrupt
MRNIU Jan 28, 2026
ee121fa
Merge branch 'interrupt' into thread
MRNIU Jan 28, 2026
a288276
style: update
MRNIU Jan 28, 2026
8766b0b
feat: mutex
MRNIU Jan 28, 2026
7765d4f
feat: mutex
MRNIU Jan 28, 2026
28b1893
fix: use std::limit
MRNIU Jan 28, 2026
a0da891
Merge branch 'boot' into memory
MRNIU Jan 28, 2026
dd46c38
Merge branch 'memory' into interrupt
MRNIU Jan 28, 2026
e0359f3
Merge branch 'interrupt' into thread
MRNIU Jan 28, 2026
c1f36b1
feat: mutex
MRNIU Jan 28, 2026
bc96496
test: fix
MRNIU Jan 28, 2026
5a33ce7
test: fix
MRNIU Jan 28, 2026
2d6fd23
test: fix
MRNIU Jan 28, 2026
9fab1de
Merge branch 'interrupt' into thread
MRNIU Jan 28, 2026
bfcb44c
feat: mutex
MRNIU Jan 28, 2026
b7cc035
refactor: spinlock
MRNIU Jan 28, 2026
d05b878
refactor: spinlock
MRNIU Jan 28, 2026
4e0f9a2
refactor: spinlock
MRNIU Jan 28, 2026
f4322d2
refactor: spinlock
MRNIU Jan 28, 2026
b30a256
refactor: spinlock
MRNIU Jan 28, 2026
b80b9a4
Merge branch 'memory' into interrupt
MRNIU Jan 28, 2026
c66eb5c
Merge branch 'interrupt' into thread
MRNIU Jan 28, 2026
b2380f5
feat: mutex
MRNIU Jan 28, 2026
cc7f96f
feat: mutex
MRNIU Jan 28, 2026
924e677
refactor: throw
MRNIU Jan 30, 2026
776d34f
style: replace static constexpr const with static constexpr
MRNIU Jan 30, 2026
82a1d51
3rd: update
MRNIU Jan 30, 2026
299a4e2
test: update ut
MRNIU Jan 30, 2026
ae1e35b
refactor: throw
MRNIU Jan 30, 2026
03bcd4a
refactor: throw
MRNIU Jan 30, 2026
88b5a24
refactor: throw
MRNIU Jan 30, 2026
28b5701
refactor: kernel_log
MRNIU Jan 30, 2026
7ea24f1
fix: DumpStack
MRNIU Jan 30, 2026
7d29b91
3rd: update
MRNIU Jan 30, 2026
130070f
Merge branch 'boot' into memory
MRNIU Jan 30, 2026
0869882
refactor: kernel_log
MRNIU Jan 30, 2026
1fe7515
refactor: kernel_log
MRNIU Jan 30, 2026
2db57bc
Merge branch 'boot' into memory
MRNIU Jan 30, 2026
3d6867f
3rd: update
MRNIU Jan 30, 2026
6326569
Merge branch 'memory' into interrupt
MRNIU Jan 30, 2026
5e3119b
feat: expected
MRNIU Jan 30, 2026
daaa72e
refactor: expected
MRNIU Jan 30, 2026
92d4653
refactor: expected
MRNIU Jan 30, 2026
c2eea70
feat: assert
MRNIU Jan 30, 2026
1917ab0
feat: assert
MRNIU Jan 30, 2026
df8b9da
feat: assert
MRNIU Jan 30, 2026
1ec6682
feat: assert
MRNIU Jan 30, 2026
4383628
refactor: expected
MRNIU Jan 30, 2026
3febd4e
refactor: expected
MRNIU Jan 30, 2026
b72176d
refactor: expected
MRNIU Jan 30, 2026
e6af4bd
refactor: expected
MRNIU Jan 30, 2026
0b60b63
Merge branch 'boot' into memory
MRNIU Jan 30, 2026
7691df4
refactor: excepted
MRNIU Jan 30, 2026
95e2eaa
refactor: excepted
MRNIU Jan 30, 2026
1c3201c
feat: -fno-exceptions
MRNIU Jan 30, 2026
a3049f0
feat: -fno-exceptions
MRNIU Jan 30, 2026
495056b
feat: -fno-exceptions
MRNIU Jan 30, 2026
bc20aa1
feat: -fno-exceptions
MRNIU Jan 30, 2026
420e560
Merge branch 'boot' into memory
MRNIU Jan 30, 2026
bfad707
refactor: excepted
MRNIU Jan 30, 2026
747ffec
Merge branch 'boot' into memory
MRNIU Jan 30, 2026
ea7431e
refactor: excepted
MRNIU Jan 30, 2026
b32df67
Merge branch 'memory' into interrupt
MRNIU Jan 30, 2026
9e624d2
refactor: excepted
MRNIU Jan 30, 2026
71d00a6
refactor: excepted
MRNIU Jan 30, 2026
0fdcae9
refactor: excepted
MRNIU Jan 30, 2026
124fd7d
fix: apic
MRNIU Jan 30, 2026
1661db8
Merge branch 'boot' into memory
MRNIU Jan 30, 2026
9b8e225
fix: apic
MRNIU Jan 30, 2026
5bd7a9b
refactor: excepted
MRNIU Jan 31, 2026
17cc02c
refactor: excepted
MRNIU Jan 31, 2026
714881c
style: fix code style
MRNIU Feb 2, 2026
cdf3710
refactor: expected
MRNIU Feb 2, 2026
f68d407
Merge branch 'boot' into memory
MRNIU Feb 2, 2026
2696787
refactor: expected
MRNIU Feb 2, 2026
a751b9b
style: fix code style
MRNIU Feb 2, 2026
15d6d52
refactor: expected
MRNIU Feb 2, 2026
5f5ea0a
doc: update copilot-instructions
MRNIU Feb 2, 2026
c408c5e
Merge branch 'boot' into memory
MRNIU Feb 2, 2026
04fc0df
Merge branch 'memory' into interrupt
MRNIU Feb 2, 2026
6c75909
style: fix code style
MRNIU Feb 2, 2026
45dbaba
style: fix code style
MRNIU Feb 2, 2026
9c9da77
fix: fdt
MRNIU Feb 2, 2026
a4e44ca
fix: fdt
MRNIU Feb 2, 2026
3d0f86b
Merge branch 'boot' into memory
MRNIU Feb 2, 2026
353b8d8
Merge branch 'memory' into interrupt
MRNIU Feb 2, 2026
2295753
Merge branch 'interrupt' into thread
MRNIU Feb 2, 2026
4975d20
refactor: expected
MRNIU Feb 2, 2026
409dce7
Merge branch 'interrupt' into thread
MRNIU Feb 2, 2026
238b6e4
refactor: expected
MRNIU Feb 2, 2026
46bdf10
refactor: expected
MRNIU Feb 2, 2026
56db45f
refactor: expected
MRNIU Feb 2, 2026
f8e5eb7
refactor: expected
MRNIU Feb 2, 2026
f8389c7
refactor: expected
MRNIU Feb 3, 2026
5d0ecf6
test: update ut
MRNIU Feb 3, 2026
7713363
style: fix code style
MRNIU Feb 3, 2026
eed175b
Merge branch 'boot' into memory
MRNIU Feb 3, 2026
f9a540c
Merge branch 'memory' into interrupt
MRNIU Feb 3, 2026
ed83bc4
style: fix code style
MRNIU Feb 3, 2026
a74031d
Merge branch 'interrupt' into thread
MRNIU Feb 3, 2026
92505eb
3rd: update
MRNIU Feb 3, 2026
7763d2e
3rd: update
MRNIU Feb 3, 2026
12c8b6a
test: add mocks
MRNIU Feb 3, 2026
ebe8f3c
test: add mocks
MRNIU Feb 3, 2026
931cf20
test: add mocks
MRNIU Feb 3, 2026
f7e6c1e
tmp
MRNIU Feb 3, 2026
067572e
test: fix
MRNIU Feb 3, 2026
97360de
test: working on ut
MRNIU Feb 3, 2026
f258e5f
test: test_environment_state
MRNIU Feb 4, 2026
1f94995
test: test_environment_state
MRNIU Feb 5, 2026
b1f95f5
refactor: thread
MRNIU Feb 9, 2026
174af2d
3rd: update
MRNIU Feb 9, 2026
007bd8f
doc: update copilot-instructions
MRNIU Feb 9, 2026
5d0a38f
doc: update workflow.yml
MRNIU Feb 9, 2026
132bcd5
test: fix test error
MRNIU Feb 9, 2026
087cacb
test: fix coverage
MRNIU Feb 9, 2026
8f8a87c
fix: Updates submodules checkout to recursive mode
MRNIU Feb 9, 2026
7a60e49
test: fix coverage
MRNIU Feb 9, 2026
4d1a745
Merge branch 'thread'
MRNIU Feb 9, 2026
7d08aa7
Merge remote-tracking branch 'upstream/main'
MRNIU Feb 9, 2026
f31fd7b
test: fix coverage
MRNIU Feb 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
393 changes: 3 additions & 390 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,395 +1,8 @@
# This file is a part of Simple-XX/SimpleKernel
# (https://github.com/Simple-XX/SimpleKernel).
#
# CMakeLists.txt for Simple-XX/SimpleKernel.
# Copyright The SimpleKernel Contributors

---
# @version clang-format version 15
# @see https://clang.llvm.org/docs/ClangFormatStyleOptions.html

# 访问说明符 public/private 的偏移,与类对齐
AccessModifierOffset: -4
# ( 后的参数对齐,与 ( 对齐
AlignAfterOpenBracket: Align
# 结构体初始化对齐,右对齐
AlignArrayOfStructures: Right
# 连续赋值对齐
AlignConsecutiveAssignments:
# 允许
Enabled: true
# 忽略空行
AcrossEmptyLines: true
# 忽略注释
AcrossComments: true
# 忽略混合运算符
AlignCompound: true
# 填充运算符
PadOperators: true
# 位域对齐
AlignConsecutiveBitFields:
# 允许
Enabled: true
# 忽略空行
AcrossEmptyLines: true
# 忽略注释
AcrossComments: true
# 忽略混合运算符
AlignCompound: true
# 填充运算符
PadOperators: true
# 连续声明对齐,忽略空行/注释
AlignConsecutiveDeclarations:
# 允许
Enabled: true
# 忽略空行
AcrossEmptyLines: true
# 忽略注释
AcrossComments: true
# 忽略混合运算符
AlignCompound: true
# 填充运算符
PadOperators: true
# 连续宏定义对齐,忽略空行/注释
AlignConsecutiveMacros:
# 允许
Enabled: true
# 忽略空行
AcrossEmptyLines: true
# 忽略注释
AcrossComments: true
# 忽略混合运算符
AlignCompound: true
# 填充运算符
PadOperators: true
# 换行符号左对齐
AlignEscapedNewlines: Left
# 操作符对齐,与 BreakBeforeBinaryOperators 共同生效
AlignOperands: AlignAfterOperator
# 行后注释对齐
AlignTrailingComments: true
# 尽量将函数调用/初始化的所有参数放在同一行,禁用
AllowAllArgumentsOnNextLine: false
# 尽量将函数声明的参数放在同一行
AllowAllParametersOfDeclarationOnNextLine: true
# 将 while (true) {} 中的 {} 合并为一行,禁用
AllowShortBlocksOnASingleLine: Never
# 将 switch case: 中的 case: 合并为一行,禁用
AllowShortCaseLabelsOnASingleLine: false
# 将枚举类型合并为一行,禁用
AllowShortEnumsOnASingleLine: false
# 将短函数合并为一行,禁用
AllowShortFunctionsOnASingleLine: None
# 将短语句合并为一行,禁用
AllowShortIfStatementsOnASingleLine: Never
# 将 lambda 表达式合并为一行,禁用
AllowShortLambdasOnASingleLine: None
# 将短循环合并为一行,禁用
AllowShortLoopsOnASingleLine: false
# 将在返回类型后换行,禁用
AlwaysBreakAfterReturnType: None
# 将在多行字符串前换行,禁用
AlwaysBreakBeforeMultilineStrings: false
# 在模版声明后换行
AlwaysBreakTemplateDeclarations: Yes
# 编译器属性排除,不会参与格式化
AttributeMacros: [ '__capability',
'__output',
'__ununsed',
'[[maybe_unused]]' ]

# 尽量将函数调用的参数放在同一行
BinPackArguments: true
# 尽量将函数声明的参数放在同一行
BinPackParameters: true
# 在位域声明的 : 前后都加空格
BitFieldColonSpacing: Both
# 大括号换行设置
BraceWrapping:
# 在 case 后换行,禁用
AfterCaseLabel: false
# 在 class 后换行,禁用
AfterClass: false
# 在控制语句后换行,禁用
AfterControlStatement: Never
# 在 enum 后换行,禁用
AfterEnum: false
# 在函数定义后换行,禁用
AfterFunction: false
# 在 namespace 后换行,禁用
AfterNamespace: false
# 在结构体后换行,禁用
AfterStruct: false
# 在联合体后换行,禁用
AfterUnion: false
# 在 extern 后换行,禁用
AfterExternBlock: false
# 在 catch 后换行,禁用
BeforeCatch: false
# 在 else 前换行
BeforeElse: true
# 在 lambda 后换行,禁用
BeforeLambdaBody: false
# 在 while 前换行,禁用
BeforeWhile: false
# 换行缩进括号,禁用
IndentBraces: false
# 空函数的大括号换行
SplitEmptyFunction: true
# 空 class/struct/union 的大括号换行
SplitEmptyRecord: true
# 空 namespace 的大括号换行
SplitEmptyNamespace: true
# 在二元操作符前换行
BreakBeforeBinaryOperators: All
# 在大括号前换行,使用自定义规则,在 BraceWrapping 中规定
BreakBeforeBraces: Custom
# 在 concept(c++20) 前换行
BreakBeforeConceptDeclarations: Always
# 在三元操作符前换行
BreakBeforeTernaryOperators: true
# 构造函数初始化列表在冒号 : 前,逗号 , 后换行
BreakConstructorInitializers: BeforeColon
# class 继承列表在冒号 : 前,逗号 , 后换行
BreakInheritanceList: BeforeColon
# 允许将字符串切割
BreakStringLiterals: true
# 最大列数
ColumnLimit: 80
# 特殊注释的正则表达式,不会进行格式化
CommentPragmas: '^ NO_STYLE:'
# 将多个 namespace 合并为一行,禁用
CompactNamespaces: false
# 构造函数的初始化列表/继承列表的缩进宽度
ConstructorInitializerIndentWidth: 4
# 续行的缩进宽度
ContinuationIndentWidth: 2
# 去除 C++11 的列表初始化的大括号 { 后和 } 前的空格,禁用
Cpp11BracedListStyle: false
# 分析文件使用最多的换行符并应用到整个文件,
# 只有当无法得到结论时才会使用 UseCRLF,禁用
DeriveLineEnding: true
# 分析文件使用最多的指针/引用的对齐方式并应用到整个文件,
# 只有当无法得到结论时才会使用 PointerAlignment,禁用
DerivePointerAlignment: false
# 关闭格式化,禁用
DisableFormat: false
# 访问描述符后的空行,只保留 MaxEmptyLinesToKeep 指定的行数
EmptyLineAfterAccessModifier: Leave
# 访问描述符前的空行,始终保留,除非是 class/struct 的开始
EmptyLineBeforeAccessModifier: Always
# 在命名空间结束后添加注释,与 ShortNamespaceLines 共同生效
FixNamespaceComments: true
# for-each 宏,作为循环语句进行格式化
ForEachMacros: [ 'RANGES_FOR', 'FOREACH' ]

# if 宏,作为条件语句进行格式化
IfMacros: [ 'IF' ]
# 将 #include 分块,规则由 IncludeCategories 指定,暂未使用
#IncludeBlocks: Regroup
# 将 #include 分块,保留原有分块
IncludeBlocks: Preserve
# 对 #include 进行排序,匹配了某正则表达式的 #include 拥有对应的优先级,
# 优先级越小排序越靠前,匹配不到的则默认优先级为 INT_MAX,暂未使用
IncludeCategories:
# 正则
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
# 优先级
Priority: 2
# 排序优先级,默认与 Priority 相同
SortPriority: 2
# 大小写敏感
CaseSensitive: true
- Regex: '^((<|")(gtest|gmock|isl|json)/)'
Priority: 3
CaseSensitive: true
- Regex: '<[[:alnum:].]+>'
Priority: 4
CaseSensitive: true
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: true
# 判断头文件是否为相关的头文件,用于排序
# 如 a.cpp 与 a.h,设置为 a.cpp/a_test.cpp
IncludeIsMainRegex: '(_test)?$'
# 判断头文件是否包含实现,用于排序
IncludeIsMainSourceRegex: '(*\.hpp)$'
# 访问控制符缩进,禁用
IndentAccessModifiers: false
# case 块缩进,禁用
IndentCaseBlocks: false
# case 标签缩进
IndentCaseLabels: true
# extern 块缩进,与 BraceWrapping.AfterExternBlock 共同生效
IndentExternBlock: AfterExternBlock
# 缩进 goto 标签,禁用
IndentGotoLabels: false
# 缩进预处理,在 # 后缩进
IndentPPDirectives: AfterHash
# 缩进 requires
IndentRequiresClause: true
# 缩进宽度
IndentWidth: 4
# 函数返回类型换行时,缩进函数声明/函数定义的函数名,禁用
IndentWrappedFunctionNames: false
# 自动插入大括号
InsertBraces: true
# 保留在块开始处的空行,禁用
KeepEmptyLinesAtTheStartOfBlocks: false
# lambda 表达式函数体缩进
LambdaBodyIndentation: OuterScope
# 语言,设置语言为 c++
Language: Cpp

# 开始一个块的宏的正则表达式
MacroBlockBegin: "^MACRO_BEGIN|NS_TABLE_HEAD$"
# 结束一个块的宏的正则表达式
MacroBlockEnd: "^MACRO_END|NS_TABLE_.*_END$"
# 最大连续空行
MaxEmptyLinesToKeep: 1
# namespace 缩进,禁用
NamespaceIndentation: None
# namespace 宏
NamespaceMacros: [ 'NAMESPACE' ]
# 预处理缩进,-1 表示使用默认值 IndentWidth
PPIndentWidth: -1
# 如果构造函数的初始化列表超过一行则换行
PackConstructorInitializers: NextLine

# 有些情况下你会觉得怎么排版都达不到完美,
# 只能各方面妥协一下(例如你限定了行宽,但注释想放宽松点允许超一些)。
# penalty 简单来说就是給每一次“违规”设定一个罚分,
# clang-format 帮你选择最终吃到的总罚分比较少的策略。
# 在赋值前后换行时的罚分
# @see https://www.zhihu.com/question/438473572/answer/1668773325
# 在赋值前后打断的罚分
PenaltyBreakAssignment: 2
# 在函数调用 fun( 后打断的罚分
PenaltyBreakBeforeFirstCallParameter: 19
# 在注释中换行的罚分
PenaltyBreakComment: 300
# 在第一个 << 点打断的罚分
PenaltyBreakFirstLessLess: 120
# 在 ( 后打断的罚分
PenaltyBreakOpenParenthesis: 100
# 在字符串常量中换行的罚分
PenaltyBreakString: 1000
# 在模版声明后打断的罚分
PenaltyBreakTemplateDeclaration: 10
# 注释的每个字符超出 ColumnLimit 的罚分
PenaltyExcessCharacter: 1000000
# 每个空格缩进的罚分,
# counted relative to leading non-whitespace column
PenaltyIndentedWhitespace: 0
# 函数返回类型单独成行的罚分
PenaltyReturnTypeOnItsOwnLine: 0
# 指针和引用对齐,左对齐
PointerAlignment: Left
# 修饰符对齐,由 QualifierOrder 指定
QualifierAlignment: Custom
# 修饰符顺序
QualifierOrder: [ 'inline', 'static', 'const', 'volatile','type' ]
# 将字符串格式化,与 ProtocolBuffers 配合使用,未使用
RawStringFormats:
- Language: Cpp
BasedOnStyle: InheritParentConfig
Delimiters: [ pb ]
# 引用对齐,与 PointerAlignment 相同
ReferenceAlignment: Pointer
# 重新排版注释
ReflowComments: true
# requires 位置,单独成行
RequiresClausePosition: OwnLine
# 在定义块之间添加空行,总是添加
SeparateDefinitionBlocks: Always
# 设置短 namespace 长度,0 表示将所有 namespace 视为 short namespace
ShortNamespaceLines: 0
# 排序 #include,按照字母序
SortIncludes: CaseInsensitive
# 排序 using 声明
SortUsingDeclarations: true
# 在 C 风格类型转换后添加空格,禁用
SpaceAfterCStyleCast: false
# 在逻辑非 ! 后添加空格,禁用
SpaceAfterLogicalNot: false
# 在 template 后添加空格
SpaceAfterTemplateKeyword: true
# 在指针修饰符周围添加空格,使用 PointerAlignment
SpaceAroundPointerQualifiers: Default
# 在赋值运算符之前添加空格
SpaceBeforeAssignmentOperators: true
# 在 case 的 : 前添加空格,禁用
SpaceBeforeCaseColon: false
# 在 c++11 大括号初始化前添加空格
SpaceBeforeCpp11BracedList: true
# 在构造函数初始化列表 : 前添加空格
SpaceBeforeCtorInitializerColon: true
# 在继承 : 前添加空格
SpaceBeforeInheritanceColon: true
# 在 ( 前添加空格,由 SpaceBeforeParensOptions 指定
SpaceBeforeParens: Custom
# 在 ( 前添加空格的规则
SpaceBeforeParensOptions:
# 在控制语句后添加
AfterControlStatements: true
# 在 for-each 宏后添加,禁用
AfterForeachMacros: false
# 在函数声明后添加,禁用
AfterFunctionDeclarationName: false
# 在函数定义后添加,禁用
AfterFunctionDefinitionName: false
# 在 if 宏后添加,禁用
AfterIfMacros: false
# 在重载运算符后添加,禁用
AfterOverloadedOperator: false
# 在 requires 后添加
AfterRequiresInClause: true
# 在表达式中的 requires 后添加,禁用
AfterRequiresInExpression: false
# 在非空的 () 前添加,禁用
BeforeNonEmptyParentheses: false
# 在范围 for 循环 : 前添加空格
SpaceBeforeRangeBasedForLoopColon: true
# 在 [ 前添加空格,禁用
SpaceBeforeSquareBrackets: false
# 在空 {} 中添加空格
SpaceInEmptyBlock: true
# 在空的圆括号中添加空格,禁用
SpaceInEmptyParentheses: false
# 在行后注释前添加空格(只适用于 //)
SpacesBeforeTrailingComments: 4
# 在尖括号的 < 后和 > 前添加空格,禁用
SpacesInAngles: Never
# 在 C 风格类型转换的括号中添加空格,禁用
SpacesInCStyleCastParentheses: false
# 在条件判断中 ( 后 ) 前添加空格,禁用
SpacesInConditionalStatement: false
# 在容器字面量中添加空格
SpacesInContainerLiterals: true
# 行注释前缀中的空格
SpacesInLineCommentPrefix:
# 最大值
Maximum: 1
# 最小值
Minimum: 1
# 在 ( 后和 ) 前添加空格,禁用
SpacesInParentheses: false
# 在 [ 后和 ] 前添加空格,lamda 表达式和未指明大小的数组的声明不受影响,禁用
SpacesInSquareBrackets: false
# cpp 标准,使用最新支持的
Standard: Latest
# 需要识别为宏的代码块前缀
StatementAttributeLikeMacros: [ ]
# 需要解释为完整代码段的宏
StatementMacros: [ ]
# tab 宽度,8 个空格
TabWidth: 8
# 需要识别为宏,而不是函数调用的宏
TypenameMacros: [ ]
# 使用 \r\n 换行符,与 DeriveLineEnding 共同生效,禁用
UseCRLF: false
# 使用 tab,禁用
UseTab: Never
# 对空格敏感的宏
WhitespaceSensitiveMacros: [ ]
# 使用 Google 规范
BasedOnStyle: Google
...
Loading