-
Notifications
You must be signed in to change notification settings - Fork 12
/
.clang-format
190 lines (153 loc) · 4.95 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# See https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# using clang-format based on style: Google
# command: clang-format -i --style=file <file>
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 120
IndentWidth: 4
IndentCaseLabels: false
AlwaysBreakTemplateDeclarations: false
DerivePointerAlignment: false
# someLongFunction(argument1,
# argument2);
AlignAfterOpenBracket: Align
# int a = 1;
# int somelongname = 2;
# double c = 3;
# int d = 3;
# /* A comment. */
# double e = 4;
AlignConsecutiveAssignments: true
# int aaaa = 12;
# float b = 23;
# std::string ccc;
# int a = 42;
# /* A comment. */
# bool c = false;
AlignConsecutiveDeclarations: true
# int aaa = bbbbbbbbbbbbbbb
# + ccccccccccccccc;
AlignOperands: true
# true: false:
# int a; // My comment a vs. int a; // My comment a
# int b = 2; // comment b int b = 2; // comment about b
AlignTrailingComments: true
# true:
# void myFunction(
# int a, int b, int c, int d, int e);
# false:
# void myFunction(int a,
# int b,
# int c,
# int d,
# int e);
AllowAllParametersOfDeclarationOnNextLine: true
# true: false:
# aaaa = vs. aaaa = "bbbb"
# "bbbb" "cccc";
# "cccc";
AlwaysBreakBeforeMultilineStrings: false
# true:
# void f() {
# f(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa,
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
# }
# false:
# void f() {
# f(aaaaaaaaaaaaaaaaaaaa,
# aaaaaaaaaaaaaaaaaaaa,
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
# }
BinPackArguments: false
# true:
# void f(int aaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
# false:
# void f(int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
BinPackParameters: false
# LooooooooooongType loooooooooooooooooooooongVariable =
# someLooooooooooooooooongFunction();
# bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ==
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >
# ccccccccccccccccccccccccccccccccccccccccc;
BreakBeforeBinaryOperators: None
# true:
# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription
# ? firstValue
# : SecondValueVeryVeryVeryVeryLong;
# false:
# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription ?
# firstValue :
# SecondValueVeryVeryVeryVeryLong;
BreakBeforeTernaryOperators: true
# Constructor()
# : initializer1(),
# initializer2()
BreakConstructorInitializers: BeforeColon
# true:
# const char* x = "veryVeryVeryVeryVeryVe"
# "ryVeryVeryVeryVeryVery"
# "VeryLongString";
# false:
# const char* x =
# "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
BreakStringLiterals: false
# int i = // VeryVeryVeryVeryVeryLongComment
# longFunction( // Again a long comment
# arg);
ContinuationIndentWidth: 2
# true: false:
# namespace a { vs. namespace a {
# foo(); foo();
# bar(); bar();
# } // namespace a }
FixNamespaceComments: true
# # include "b.h" into #include "a.h"
# #include "b.h"
# #include <lib/main.h>
# #include "a.h" #include <lib/main.h>
IncludeBlocks: Regroup
# #if FOO
# #if BAR
# #include <foo>
# #endif
# #endif
IndentPPDirectives: BeforeHash
# true:
# LoooooooooooooooooooooooooooooooooooooooongReturnType
# LoooooooooooooooooooooooooooooooongFunctionDeclaration();
# false:
# LoooooooooooooooooooooooooooooooooooooooongReturnType
# LoooooooooooooooooooooooooooooooongFunctionDeclaration();
IndentWrappedFunctionNames: true
# false:
# // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
# /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
# true:
# // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
# // information
# /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
# * information */
ReflowComments: false
# Right:
# struct test demo[] =
# {
# {56, 23, "hello"},
# {-1, 93463, "world"},
# { 7, 5, "!!"}
# };
AlignArrayOfStructures: Right
# #define SHORT_NAME 42
# #define LONGER_NAME 0x007f
# #define EVEN_LONGER_NAME (2)
# #define foo(x) (x * x)
# #define bar(y, z) (y + z)
AlignConsecutiveMacros: AcrossEmptyLines
# int aaaa : 1;
# int b : 12;
# int ccc : 8;
AlignConsecutiveBitFields: AcrossEmptyLines