-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.clang-format
201 lines (166 loc) · 5.28 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
191
192
193
194
195
196
197
198
199
200
201
AccessModifierOffset: 0
# Align at =
# auto var1 = value1;
# auto variable1 = value2;
AlignConsecutiveAssignments: true
# Align declarations
# ClassFoo foo;
# ClassFooBar foobar;
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
# false:
# void myFunction(int a,
# int d,
# int e);
AllowAllParametersOfDeclarationOnNextLine: false
# false:
# void f() {
# f(aaaaaaaaaaaaaaaaaaaa,
# aaaaaaaaaaaaaaaaaaaa,
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
# }
AllowShortLambdasOnASingleLine: true
BreakBeforeBraces: Custom
BinPackArguments: false
BinPackParameters: false
# if true this allows if (a) { return; } to be put on a single line.
AllowShortBlocksOnASingleLine: true
# true: false:
# switch (a) { vs. switch (a) {
# case 1: x = 1; break; case 1:
# case 2: return; x = 1;
# } break;
AllowShortCaseLabelsOnASingleLine: true
# class Foo {
# void f() { foo(); }
# };
AllowShortFunctionsOnASingleLine: InlineOnly
# If true, if (a) return; can be put on a single line.
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
# LooooooooooongType loooooooooooooooooooooongVariable
# = someLooooooooooooooooongFunction();
# bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# > ccccccccccccccccccccccccccccccccccccccccc;
BreakBeforeBinaryOperators: All
# try
# {
# foo();
# }
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: false
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
# true:
# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription
# ? firstValue
# : SecondValueVeryVeryVeryVeryLong;
BreakBeforeTernaryOperators: true
# Constructor() :
# initializer1(),
# initializer2()
BreakConstructorInitializers: AfterColon
# Type& name <- instead of -> Type &name
PointerAlignment: Left
# Using 120 for now. Pending survey results
ColumnLimit: 140
IndentWidth: 4
Language: Cpp
MaxEmptyLinesToKeep: 1
# #define A \
# int aaaa; \
# int b; \
# int dddddddddd;
AlignEscapedNewlines: Left
# true:
# SomeClass::Constructor()
# : aaaaaaaa(aaaaaaaa), aaaaaaaa(aaaaaaaa), aaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa) {
# return 0;
# }
# SomeClass::Constructor()
# : aaaaaaaa(aaaaaaaa),
# aaaaaaaa(aaaaaaaa),
# aaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa) {
# return 0;
# }
ConstructorInitializerAllOnOneLineOrOnePerLine: true
# int i = // VeryVeryVeryVeryVeryLongComment
# longFunction( // Again a long comment
# arg);
ContinuationIndentWidth: 4
# true: vector<int> x{1, 2, 3, 4}; vs. false: vector<int> x{ 1, 2, 3, 4 };
Cpp11BracedListStyle: true
# Force pointers to the type for C++.
# int* a;
DerivePointerBinding: false
# Automatically add namespace comment at the end of namespace
# namespace a {
# foo();
# } // namespace a;
FixNamespaceComments: true
# Sort each #include block separately
# #include "b.h" into #include "b.h"
#
# #include <lib/main.h> #include "a.h"
##include "a.h" #include <lib/main.h>
IncludeBlocks: Preserve
# false: true:
# switch (fool) { vs. switch (fool) {
# case 1: case 1:
IndentCaseLabels: false
# true: false:
# int a = 5; vs. int a=5;
# a += 42 a+=42;
SpaceBeforeAssignmentOperators: true
#void f() {
# if (true) { // foo1
# f(); // bar
# } // foo
#}
SpacesBeforeTrailingComments: 4
# true: false:
# static_cast< int >(arg); vs. static_cast<int>(arg);
# std::function< void(int) > fct; std::function<void(int)> fct;
SpacesInAngles: false
# true: false:
# x = ( int32 )y vs. x = (int32)y
SpacesInCStyleCastParentheses: false
# true: false:
# var arr = [ 1, 2, 3 ]; vs. var arr = [1, 2, 3];
# if({a : 1, b : 2, c : 3}); f({a: 1, b: 2, c: 3});
SpacesInContainerLiterals: false
# Need description and justification
#PenaltyBreakBeforeFirstCallParameter: 100
#PenaltyBreakComment: 100
#PenaltyBreakFirstLessLess: 0
#PenaltyBreakString: 100
#PenaltyExcessCharacter: 1
#PenaltyReturnTypeOnItsOwnLine: 20
#AlwaysBreakBeforeMultilineStrings: true
#AlwaysBreakTemplateDeclarations: true
Standard: Cpp11
TabWidth: 4
UseTab: Never