Skip to content

Commit ef3a8cc

Browse files
add .clang-format (#2606)
* QOL: .clang-format * This section is not used when 'BreakBeforeBraces' is set
1 parent 553d5b5 commit ef3a8cc

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.clang-format

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Based on LLVM coding standards
2+
BasedOnStyle: LLVM
3+
4+
# Use 4 spaces for indentation
5+
IndentWidth: 4
6+
7+
# Use 4 spaces for continuations
8+
ContinuationIndentWidth: 4
9+
10+
# Allow short functions to be on a single line
11+
AllowShortFunctionsOnASingleLine: false
12+
13+
# Column limit for wrapping
14+
ColumnLimit: 0
15+
16+
# Break before braces for functions and classes
17+
BreakBeforeBraces: Allman
18+
19+
# Function declaration return type alignment
20+
AlignTrailingComments: true
21+
AlignAfterOpenBracket: true
22+
AlignEscapedNewlines: Left
23+
AlignOperands: true
24+
AlignConsecutiveAssignments: false
25+
AlignConsecutiveDeclarations: false
26+
27+
# Control statements
28+
AllowShortIfStatementsOnASingleLine: true
29+
AllowShortLoopsOnASingleLine: false
30+
IndentCaseLabels: true
31+
32+
# Pointer alignment
33+
PointerAlignment: Left
34+
35+
# Space before and after operators
36+
SpaceBeforeParens: ControlStatements
37+
SpaceBeforeRangeBasedForLoopColon: true
38+
SpacesBeforeTrailingComments: 1
39+
SpacesInCStyleCastParentheses: false
40+
SpacesInContainerLiterals: false
41+
SpacesInParentheses: false
42+
43+
# Namespace indentation
44+
NamespaceIndentation: None
45+
46+
# Empty line before access modifiers in classes
47+
EmptyLineBeforeAccessModifier: LogicalBlock
48+
49+
# Add space between statements
50+
SpaceBeforeAssignmentOperators: true
51+
52+
# No space before opening brackets
53+
SpaceBeforeSquareBrackets: false
54+
55+
# No space before or after '<' and '>' in template argument lists
56+
SpacesInAngles: false
57+
58+
# Handling include statements
59+
IncludeBlocks: Preserve
60+
IncludeCategories:
61+
- Regex: '^<.*\.h>'
62+
Priority: 1
63+
- Regex: '^".*\.h"'
64+
Priority: 2
65+
66+
# Keep empty lines at the start of blocks
67+
KeepEmptyLinesAtTheStartOfBlocks: true
68+
69+
# Indentation style for preprocessor directives
70+
IndentPPDirectives: AfterHash
71+
72+
# Wrap comments to fit within column limit
73+
ReflowComments: false

0 commit comments

Comments
 (0)