Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fs #155

Open
wants to merge 4,403 commits into
base: fs
Choose a base branch
from
Open

Fs #155

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
4403 commits
Select commit Hold shift + click to select a range
627bbc2
style(clangformat): update
MRNIU Apr 11, 2023
4f50da8
style(clangformat): update
MRNIU Apr 11, 2023
40019f2
feat(cmake): objcopy
MRNIU Apr 11, 2023
8df1411
feat(cmake): objcopy
MRNIU Apr 11, 2023
c2e76d2
Merge branch 'boot' into printf
MRNIU Apr 11, 2023
0d2751d
Merge branch 'boot' into printf
MRNIU Apr 11, 2023
d6810ec
perf(build): not support bochs any more
MRNIU Apr 12, 2023
a3c5058
perf(build): not support bochs any more
MRNIU Apr 12, 2023
a3b397d
perf(build): not support bochs any more
MRNIU Apr 12, 2023
88a64ff
perf(build): not support bochs any more
MRNIU Apr 12, 2023
707b042
perf(build): not support bochs any more
MRNIU Apr 12, 2023
15a818e
perf(build): not support bochs any more
MRNIU Apr 12, 2023
6794e72
perf(build): not support bochs any more
MRNIU Apr 12, 2023
d03cbb2
perf(build): not support bochs any more
MRNIU Apr 12, 2023
e434ef7
docs: add uefi spec
MRNIU Apr 12, 2023
48bb6c1
docs: add uefi spec
MRNIU Apr 12, 2023
c62a70b
Merge branch 'boot' into printf
MRNIU Apr 12, 2023
fe3dc9f
Merge branch 'boot' into printf
MRNIU Apr 12, 2023
4fee2e8
Merge branch 'printf' into parse_boot_info
MRNIU Apr 12, 2023
0c8fc2f
Merge branch 'printf' into parse_boot_info
MRNIU Apr 12, 2023
b414fa9
Merge branch 'parse_boot_info' into pmm
MRNIU Apr 12, 2023
4136803
Merge branch 'parse_boot_info' into pmm
MRNIU Apr 12, 2023
6097775
Merge branch 'pmm' into vmm
MRNIU Apr 12, 2023
80fa94f
Merge branch 'pmm' into vmm
MRNIU Apr 12, 2023
481c91a
Merge branch 'vmm' into heap
MRNIU Apr 12, 2023
377b9a9
Merge branch 'vmm' into heap
MRNIU Apr 12, 2023
d19b4c2
Merge branch 'heap' into lib
MRNIU Apr 12, 2023
21dc3d3
Merge branch 'heap' into lib
MRNIU Apr 12, 2023
b5f2574
Merge branch 'lib' into intr
MRNIU Apr 12, 2023
2613c35
Merge branch 'lib' into intr
MRNIU Apr 12, 2023
26978a1
style(cmake): update
MRNIU Apr 12, 2023
174b909
style(cmake): update
MRNIU Apr 12, 2023
623b0fc
Merge branch 'boot' into printf
MRNIU Apr 12, 2023
caefe04
Merge branch 'boot' into printf
MRNIU Apr 12, 2023
5e5ec5c
Merge branch 'printf' into parse_boot_info
MRNIU Apr 12, 2023
b2c28a8
Merge branch 'printf' into parse_boot_info
MRNIU Apr 12, 2023
f431aae
Merge branch 'parse_boot_info' into pmm
MRNIU Apr 12, 2023
6d67b90
Merge branch 'parse_boot_info' into pmm
MRNIU Apr 12, 2023
8a9e718
Merge branch 'pmm' into vmm
MRNIU Apr 12, 2023
e51d914
Merge branch 'pmm' into vmm
MRNIU Apr 12, 2023
a47e3b1
Merge branch 'vmm' into heap
MRNIU Apr 12, 2023
b9261b8
Merge branch 'vmm' into heap
MRNIU Apr 12, 2023
c59a212
Merge branch 'heap' into lib
MRNIU Apr 12, 2023
d9d2a06
Merge branch 'heap' into lib
MRNIU Apr 12, 2023
badde09
Merge branch 'lib' into intr
MRNIU Apr 12, 2023
8d99956
Merge branch 'lib' into intr
MRNIU Apr 12, 2023
8915747
fix(shell): https://github.com/Simple-XX/SimpleKernel/issues/126
MRNIU Apr 12, 2023
d03af9f
fix(shell): https://github.com/Simple-XX/SimpleKernel/issues/126
MRNIU Apr 12, 2023
d94137a
Merge branch 'boot' into printf
MRNIU Apr 12, 2023
fc9495b
Merge branch 'boot' into printf
MRNIU Apr 12, 2023
b64da69
Merge branch 'printf' into parse_boot_info
MRNIU Apr 12, 2023
43c3e29
Merge branch 'printf' into parse_boot_info
MRNIU Apr 12, 2023
75d613d
Merge branch 'parse_boot_info' into pmm
MRNIU Apr 12, 2023
318d305
Merge branch 'parse_boot_info' into pmm
MRNIU Apr 12, 2023
13fcb18
Merge branch 'pmm' into vmm
MRNIU Apr 12, 2023
84540dc
Merge branch 'pmm' into vmm
MRNIU Apr 12, 2023
a80462a
Merge branch 'vmm' into heap
MRNIU Apr 12, 2023
041e2bf
Merge branch 'vmm' into heap
MRNIU Apr 12, 2023
27647c9
Merge branch 'heap' into lib
MRNIU Apr 12, 2023
e4bc0b7
Merge branch 'heap' into lib
MRNIU Apr 12, 2023
bde8294
Merge branch 'lib' into intr
MRNIU Apr 12, 2023
1a9164b
Merge branch 'lib' into intr
MRNIU Apr 12, 2023
e489245
fix(opensbi): update
MRNIU Apr 12, 2023
c5b9b31
fix(opensbi): update
MRNIU Apr 12, 2023
a2b353c
fix(opensbi): update
MRNIU Apr 12, 2023
7afcb09
fix(opensbi): update
MRNIU Apr 12, 2023
0006162
Merge branch 'boot' into printf
MRNIU Apr 12, 2023
5d85b06
Merge branch 'boot' into printf
MRNIU Apr 12, 2023
4b16f03
Merge branch 'printf' into parse_boot_info
MRNIU Apr 12, 2023
df5d391
Merge branch 'printf' into parse_boot_info
MRNIU Apr 12, 2023
b80b4c6
Merge branch 'parse_boot_info' into pmm
MRNIU Apr 12, 2023
dc23ab9
Merge branch 'parse_boot_info' into pmm
MRNIU Apr 12, 2023
bf56a14
Merge branch 'pmm' into vmm
MRNIU Apr 12, 2023
1970a5e
Merge branch 'pmm' into vmm
MRNIU Apr 12, 2023
8369e2b
Merge branch 'vmm' into heap
MRNIU Apr 12, 2023
bb1d063
Merge branch 'vmm' into heap
MRNIU Apr 12, 2023
2405669
Merge branch 'heap' into lib
MRNIU Apr 12, 2023
808db96
Merge branch 'heap' into lib
MRNIU Apr 12, 2023
349eb43
Merge branch 'lib' into intr
MRNIU Apr 12, 2023
a31b3f2
Merge branch 'lib' into intr
MRNIU Apr 12, 2023
eec7670
Merge branch 'intr' into vfs
MRNIU May 8, 2023
9e02f38
feat(libcxx): Stack Smashing Protector
MRNIU May 8, 2023
407853f
feat(libcxx): Stack Smashing Protector
MRNIU May 8, 2023
b63faf6
feat(libcxx): clibs
MRNIU May 8, 2023
6aa9174
feat(libcxx): clibs
MRNIU May 8, 2023
96fbeb8
Merge branch 'printf' into parse_boot_info
MRNIU May 8, 2023
f34ee45
Merge branch 'printf' into parse_boot_info
MRNIU May 8, 2023
0c45f63
Merge branch 'parse_boot_info' into pmm
MRNIU May 8, 2023
b1a3f2c
Merge branch 'parse_boot_info' into pmm
MRNIU May 8, 2023
d393b38
Merge branch 'pmm' into vmm
MRNIU May 8, 2023
5217b5f
Merge branch 'pmm' into vmm
MRNIU May 8, 2023
ef463b3
Merge branch 'vmm' into heap
MRNIU May 8, 2023
fc9985f
Merge branch 'vmm' into heap
MRNIU May 8, 2023
67dda4d
Merge branch 'heap' into lib
MRNIU May 8, 2023
1e31c93
Merge branch 'heap' into lib
MRNIU May 8, 2023
4c6016a
Merge branch 'lib' into intr
MRNIU May 8, 2023
fb09084
Merge branch 'lib' into intr
MRNIU May 8, 2023
1a8e575
Merge branch 'intr' into vfs
MRNIU May 8, 2023
771b075
style(vfs): update
MRNIU May 8, 2023
20652f0
perf(vfs): update
MRNIU May 8, 2023
bf0d678
fix(libcxx): update
MRNIU May 8, 2023
ddce710
fix(libcxx): update
MRNIU May 8, 2023
ba599d8
Merge branch 'lib' into intr
MRNIU May 8, 2023
01b8b7e
Merge branch 'lib' into intr
MRNIU May 8, 2023
0c2089c
Merge branch 'intr' into vfs
MRNIU May 8, 2023
5f55ee6
style(vfs): update
MRNIU May 8, 2023
e11684e
feat(fatfs): add codes
MRNIU May 8, 2023
d4dbead
perf(fatfs): add codes
MRNIU May 8, 2023
6cf3ad9
style(fatfs): diskio.h
MRNIU May 8, 2023
979d9b9
style(fatfs): ff.h
MRNIU May 8, 2023
c8cd2b8
style(fatfs): ffconf.h
MRNIU May 8, 2023
17622e4
style(fatfs): ff.h
MRNIU May 9, 2023
928eb76
style(fatfs): diskio.h
MRNIU May 9, 2023
2c9edc9
style(fatfs): diskio.c
MRNIU May 9, 2023
73d748c
style(fatfs): ffsystem.c
MRNIU May 9, 2023
c847434
style(fatfs): ffsystem.c
MRNIU May 9, 2023
9531681
style(fatfs): diskio.c
MRNIU May 9, 2023
96dfbe9
style(fatfs): diskio.c, diskio.h
MRNIU May 9, 2023
f23c2dc
style(fatfs): ffsystem.c
MRNIU May 9, 2023
44455fb
style(fatfs): diskio.c, diskio.h
MRNIU May 9, 2023
2b89b08
style(fatfs): ffconf.h
MRNIU May 9, 2023
d60f7fd
style(fatfs): ffunicode.c
MRNIU May 9, 2023
226c3a5
style(fatfs): ffconf.h
MRNIU May 9, 2023
5c1a63c
style(fatfs): ff.h
MRNIU May 9, 2023
df39e21
perf(fatfs): change to cpp
MRNIU May 9, 2023
072f818
style(fatfs): ff.cpp
MRNIU May 9, 2023
8ba7712
Merge branch 'intr' into device
MRNIU May 9, 2023
04f8ac4
Merge branch 'device' into vfs
MRNIU May 9, 2023
9413e83
feat(fs): still bugs
MRNIU May 9, 2023
4a5efde
feat(fs): test
MRNIU May 9, 2023
6a5e4f9
perf(device): working on device and driver
MRNIU May 9, 2023
c67dc70
perf(device): working on device and driver
MRNIU May 10, 2023
8dc773f
perf(dtb): use compatible as resource name
MRNIU May 10, 2023
b6eee97
perf(dtb): use compatible as resource name
MRNIU May 10, 2023
0059ed9
Merge branch 'parse_boot_info' into pmm
MRNIU May 10, 2023
134c8a0
Merge branch 'parse_boot_info' into pmm
MRNIU May 10, 2023
d55e8c8
Merge branch 'pmm' into vmm
MRNIU May 10, 2023
7f9ab9e
Merge branch 'pmm' into vmm
MRNIU May 10, 2023
8fc1251
Merge branch 'vmm' into heap
MRNIU May 10, 2023
fad5ee2
Merge branch 'vmm' into heap
MRNIU May 10, 2023
142b50d
Merge branch 'heap' into lib
MRNIU May 10, 2023
fa2d352
Merge branch 'heap' into lib
MRNIU May 10, 2023
dcf3044
Merge branch 'lib' into intr
MRNIU May 10, 2023
ab85b14
Merge branch 'lib' into intr
MRNIU May 10, 2023
58a8189
Merge branch 'intr' into device
MRNIU May 10, 2023
6b36630
perf(device): update
MRNIU May 10, 2023
02a7ad0
fix(dtb): fix warning
MRNIU May 10, 2023
73dfe32
fix(dtb): fix warning
MRNIU May 10, 2023
7f277e0
Merge branch 'parse_boot_info' into pmm
MRNIU May 10, 2023
8e179f6
Merge branch 'parse_boot_info' into pmm
MRNIU May 10, 2023
8861aea
Merge branch 'pmm' into vmm
MRNIU May 10, 2023
d6ce7fa
Merge branch 'pmm' into vmm
MRNIU May 10, 2023
6ab15ef
Merge branch 'vmm' into heap
MRNIU May 10, 2023
be5fca9
Merge branch 'vmm' into heap
MRNIU May 10, 2023
9f946dd
Merge branch 'heap' into lib
MRNIU May 10, 2023
a7e96bc
Merge branch 'heap' into lib
MRNIU May 10, 2023
46b04e7
Merge branch 'lib' into intr
MRNIU May 10, 2023
223dc04
Merge branch 'lib' into intr
MRNIU May 10, 2023
8cfabd8
fix(dtb): fix warning
MRNIU May 10, 2023
034c8ad
perf(device): update base
MRNIU May 10, 2023
3b0fea3
perf(device): update virtio_dev
MRNIU May 10, 2023
7173a7a
perf(device): ready to virtio drv
MRNIU May 10, 2023
97a95a9
perf(device): packed virtqueue and split virtqueue
MRNIU May 10, 2023
bd6907d
perf(device): packed virtqueue and split virtqueue
MRNIU May 10, 2023
2161e3d
perf(device): packed virtqueue not supported, switch to split virtqueue
MRNIU May 10, 2023
267fb17
perf(device): get data
MRNIU May 10, 2023
465db9c
perf(device): need test
MRNIU May 10, 2023
2052067
feat(device, fat32): read done, buf not recognize fs
MRNIU May 10, 2023
02d62ed
perf(device): clean code
MRNIU May 10, 2023
671693d
Merge branch 'device' into fs
MRNIU May 10, 2023
fc4dfb0
perf(device): clean code
MRNIU May 10, 2023
1def054
perf(device): clean code
MRNIU May 10, 2023
d290f62
Merge branch 'device' into fs
MRNIU May 10, 2023
956c170
fix(fs): todo: wait disk intr
MRNIU May 11, 2023
ca7d70a
feat(vfs): file_t
MRNIU May 11, 2023
cdb57da
perf(device): clean code
MRNIU May 11, 2023
5ef6dbd
merge device
MRNIU May 11, 2023
5d153e6
perf(device): clean code
MRNIU May 11, 2023
55fe8ef
Merge branch 'device' into fs
MRNIU May 11, 2023
b963c3b
perf(device): clean code
MRNIU May 11, 2023
9b1a9dd
Merge branch 'device' into fs
MRNIU May 11, 2023
51680eb
perf(device): clean code
MRNIU May 12, 2023
c0f556e
perf(device): cout<<
MRNIU May 12, 2023
3ab8aef
perf(device): cout<<
MRNIU May 12, 2023
17cc7b9
perf(device): regs
MRNIU May 12, 2023
2069a08
perf(device): regs
MRNIU May 12, 2023
d44a23e
style(*): update
MRNIU May 12, 2023
90889ea
style(*): update
MRNIU May 12, 2023
8fa0baa
style(*): update
MRNIU May 12, 2023
de1a579
style(*): update
MRNIU May 12, 2023
bcc3512
perf(io): change to static
MRNIU May 12, 2023
638f2b8
perf(io): change to static
MRNIU May 12, 2023
7394ac0
style(*): update
MRNIU May 12, 2023
1513f72
style(*): update
MRNIU May 12, 2023
5f556af
Merge branch 'printf' into parse_boot_info
MRNIU May 12, 2023
d54dc7f
Merge branch 'printf' into parse_boot_info
MRNIU May 12, 2023
09a39de
Merge branch 'parse_boot_info' into pmm
MRNIU May 12, 2023
a8e3763
Merge branch 'parse_boot_info' into pmm
MRNIU May 12, 2023
fc1752b
Merge branch 'pmm' into vmm
MRNIU May 12, 2023
572ee9e
Merge branch 'pmm' into vmm
MRNIU May 12, 2023
f7f787b
Merge branch 'vmm' into heap
MRNIU May 12, 2023
d6c7b12
Merge branch 'vmm' into heap
MRNIU May 12, 2023
065ffa9
Merge branch 'heap' into lib
MRNIU May 12, 2023
7d98740
Merge branch 'heap' into lib
MRNIU May 12, 2023
b6638ec
Merge branch 'lib' into intr
MRNIU May 12, 2023
aecf6df
Merge branch 'lib' into intr
MRNIU May 12, 2023
3bb370c
Merge branch 'intr' into device
MRNIU May 12, 2023
88523c1
Merge branch 'device' into fs
MRNIU May 12, 2023
da75f1f
perf(mkfatfs): 64mb
MRNIU May 12, 2023
58709e0
perf(mkfatfs): 48mb
MRNIU May 12, 2023
638663f
perf(mkfatfs): 48mb
MRNIU May 12, 2023
97b3090
Merge branch 'device' into fs
MRNIU May 12, 2023
1b4e9f0
style(*): update
MRNIU May 12, 2023
91926d6
style(*): update
MRNIU May 12, 2023
2316d93
Merge branch 'printf' into parse_boot_info
MRNIU May 12, 2023
ef9c734
style(*): update
MRNIU May 12, 2023
de99646
Merge branch 'pmm' into vmm
MRNIU May 12, 2023
5462a4f
style(*): update
MRNIU May 12, 2023
37bf5ff
Merge branch 'pmm' into vmm
MRNIU May 12, 2023
280209e
fix(ia32): update cpu.hpp
MRNIU May 12, 2023
75d9fbf
Merge branch 'vmm' into heap
MRNIU May 12, 2023
7d36238
Merge branch 'heap' into lib
MRNIU May 12, 2023
c729a82
merge heap
MRNIU May 12, 2023
245d2ae
style(*): update
MRNIU May 12, 2023
ce4a203
style(*): update
MRNIU May 12, 2023
87568ca
style(*): update
MRNIU May 12, 2023
695bae8
style(*): update
MRNIU May 12, 2023
c4b6550
Merge branch 'device' into fs
MRNIU May 12, 2023
d5d7488
perf(env): update arch
MRNIU May 12, 2023
f334c21
Merge branch 'boot' into printf
MRNIU May 12, 2023
e4bdccc
Merge branch 'printf' into parse_boot_info
MRNIU May 12, 2023
5f72858
Merge branch 'parse_boot_info' into pmm
MRNIU May 12, 2023
ad09d1f
Merge branch 'pmm' into vmm
MRNIU May 12, 2023
a40f638
Merge branch 'vmm' into heap
MRNIU May 12, 2023
c9feed5
Merge branch 'heap' into lib
MRNIU May 12, 2023
884fcd3
Merge branch 'lib' into intr
MRNIU May 12, 2023
15d9f7a
Merge branch 'intr' into device
MRNIU May 12, 2023
9c1178a
Merge branch 'device' into fs
MRNIU May 12, 2023
1939072
perf(device): device buf
MRNIU May 26, 2023
ba44f00
merge(device): device buf
MRNIU May 26, 2023
2d43200
feat(libcxx): atomic
MRNIU May 26, 2023
d8e3ae2
Merge branch 'device' into fs
MRNIU May 26, 2023
bee2f07
feat(libcxx): atomic
MRNIU May 26, 2023
6cf89b7
fix(device): read
MRNIU May 27, 2023
3202833
Merge branch 'device' into fs
MRNIU May 27, 2023
08a5f75
fix(device_base): update read/write
MRNIU May 27, 2023
e90f062
Merge branch 'device' into fs
MRNIU May 27, 2023
854be45
fix(plic): send done
MRNIU May 27, 2023
845fde2
Merge branch 'device' into fs
MRNIU May 27, 2023
9c87173
test(fs): test fatfs, error occurred while writing
MRNIU May 27, 2023
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
  •  
  •  
  •  
395 changes: 395 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,395 @@
# This file is a part of Simple-XX/SimpleKernel
# (https://github.com/Simple-XX/SimpleKernel).
#
# CMakeLists.txt for Simple-XX/SimpleKernel.

---
# @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: [ ]
...
Loading