-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.clang-format
More file actions
134 lines (107 loc) · 3.17 KB
/
.clang-format
File metadata and controls
134 lines (107 loc) · 3.17 KB
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
# Based on the LLVM style with customizations.
BasedOnStyle: LLVM
# Keep the * operator close to the type.
PointerAlignment: Left
# Limit for the length of each line.
ColumnLimit: 120
# Indentation size (2 spaces for consistency with C/C++).
IndentWidth: 2
# Use spaces instead of tabs.
UseTab: Never
# Force template declaration on a new line.
AlwaysBreakTemplateDeclarations: Yes
# Function arguments formatting.
AlignAfterOpenBracket: AlwaysBreak
AllowShortFunctionsOnASingleLine: InlineOnly
AllowAllParametersOfDeclarationOnNextLine: true
AllowAllArgumentsOnNextLine: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
BeforeElse: false
IndentBraces: false
# Align parameters to improve readability.
AlignConsecutiveDeclarations: true
AlignConsecutiveAssignments: true
AlignTrailingComments: true
# Spacing.
SpaceBeforeParens: ControlStatements
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesInAngles: false
# Configure handling of structs and classes.
AlwaysBreakAfterReturnType: None
AllowShortBlocksOnASingleLine: false
BinPackParameters: false
BinPackArguments: true
# Configure handling of operators and parameters.
BreakBeforeBinaryOperators: NonAssignment
BreakConstructorInitializers: AfterColon
# Macro names always in uppercase.
MacroBlockBegin: AlwaysBreak
MacroBlockEnd: AlwaysBreak
# Penalties to make breaks smarter.
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyBreakBeforeFirstCallParameter: 100
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1200000
# Modern C++20/23: requires, concepts, constraints.
Standard: c++20
IndentRequiresClause: true
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
BreakBeforeConceptDeclarations: Always
# Handling constructor initializer lists.
PackConstructorInitializers: CurrentLine
ConstructorInitializerIndentWidth: 4
# Lambdas and trailing return types.
LambdaBodyIndentation: Signature
AllowShortLambdasOnASingleLine: All
# Namespace indentation.
CompactNamespaces: false
NamespaceIndentation: None
# Modern C++ attributes [[nodiscard]], [[maybe_unused]], etc.
SpaceBeforeCpp11BracedList: false
Cpp11BracedListStyle: true
# Align operands in multi-line expressions.
AlignOperands: Align
# Include headers handling.
IncludeBlocks: Regroup
SortIncludes: CaseSensitive
IncludeCategories:
- Regex: '^".*\.hpp"'
Priority: 1
- Regex: '^<ads/.*>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 3
- Regex: '^<.*>'
Priority: 4
# Separation between definitions.
SeparateDefinitionBlocks: Always
MaxEmptyLinesToKeep: 2
# Handling classes and structs.
EmptyLineBeforeAccessModifier: LogicalBlock
EmptyLineAfterAccessModifier: Never
# References alignment (like pointers).
ReferenceAlignment: Left
SpaceAroundPointerQualifiers: Default
# Const/volatile qualifiers.
QualifierAlignment: Leave
# Comments and documentation.
ReflowComments: true
CommentPragmas: '^(!|/)'
# Formatting numeric literals with separators.
IntegerLiteralSeparator:
Binary: 4
Decimal: 3
Hex: 4
# C++23 options.
InsertBraces: false
RemoveSemicolon: false
# Compact namespaces for short namespaces.
ShortNamespaceLines: 10