This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
forked from apple/darwin-xnu
-
Notifications
You must be signed in to change notification settings - Fork 4
/
.clang-format
122 lines (95 loc) · 3.09 KB
/
.clang-format
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
# Format of this file is YAML
# Minimum clang-format version required: clang-format version 3.6.0
# Detailed description of options available at http://clang.llvm.org/docs/ClangFormatStyleOptions.html
AlignEscapedNewlinesLeft: true
# Bad:
# void foo() {
# someFunction();
# someOtherFunction();
# }
# Good:
# void foo() {
# someFunction();
# someOtherFunction();
# }
AlignTrailingComments: true
# align all comments to right based of //
# == Avoid using // based comments altogether ==
AllowAllParametersOfDeclarationOnNextLine: true
# allow funtion definition as
# someFunction(foo,
# bar,
# baz);
AlignConsecutiveAssignments: true
# aligns consecutive assignments with '=' operator
AllowShortBlocksOnASingleLine: true
# single statement block can be merged on one line
# e.g if (a) { return; }
AllowShortCaseLabelsOnASingleLine: false
# Single statement case statements should be on their own lines
AllowShortFunctionsOnASingleLine: None
# Bad:
# int foo() { return 123; }
AllowShortIfStatementsOnASingleLine: false
# Bad:
# if (someOtherVar) return;
# Good:
# if (someOtherVar)
# return;
AllowShortLoopsOnASingleLine: false
# Bad:
# while(i>0) i--;
# Good:
# while(i>0) {
# i--;
# }
AlwaysBreakAfterDefinitionReturnType: true
# Ensures return type is one its own line
# e.g. unsigned int
# function(char param) { }
AlwaysBreakBeforeMultilineStrings: true
# multine strings should begin on new line
BinPackArguments: true
BinPackParameters: false
# functions arguments should all be on one line or have a single line for each param
BreakBeforeBinaryOperators: None
# break for new line after binary operator in case of length is over ColumnLimit
# e.g.
# int foo = bar +
# baz;
BreakBeforeBraces: Linux
# Always attach braces to surrounding context except -
# break before braces on function, namespace and class definitions
ColumnLimit: 132
# every body has wide screen now. 132 seems to be reasonable limit now.
IndentCaseLabels: false
# case labels have same indentation as switch statement.
IndentWidth: 4
# 4 spaces for indentation
TabWidth: 4
# tabwidth is 4 spaces
UseTab: ForIndentation
# tab for indentation only. All alignment should happen with spaces
# Simple rule to check.
# No tabs allowed after first 'non-tab' character in a line
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
# remove excess empty lines at start of blocks.
PointerAlignment: Middle
SpaceAfterCStyleCast: false
# No space after (cast). E.g
# int blah = (int)((void *)foo + bar)
SpaceBeforeAssignmentOperators: true
# Assignment = should be seperated by spaces on both sides.
SpaceBeforeParens: ControlStatements
# for control statements a space is required before '('
# Bad: for() { statement; }
# Good: for () { statement; }
# This setting distinguishes functions() from keywords like 'if' and 'for'.
SpaceInEmptyParentheses: false
# No spaces required for empty ()
SpacesInCStyleCastParentheses: false
# No spaces required for (unsigned int) type cast
SpacesInParentheses: false
SpacesInSquareBrackets: false
# No spaces in [count] style invocations of []