1 # This file is an example configuration for clang-format 5.0.
\r
3 # Note that this style definition should only be understood as a hint
\r
4 # for writing new code. The rules are still work-in-progress and does
\r
5 # not yet exactly match the style we have in the existing code.
\r
7 # C Language specifics
\r
14 ContinuationIndentWidth: 0
\r
15 ConstructorInitializerIndentWidth: 4
\r
16 AccessModifierOffset: -4
\r
18 # Align parameters on the open bracket
\r
19 # someLongFunction(argument1,
\r
21 AlignAfterOpenBracket: Align
\r
23 # Don't align consecutive assignments
\r
26 AlignConsecutiveAssignments: false
\r
28 # Don't align consecutive declarations
\r
31 AlignConsecutiveDeclarations: false
\r
33 # Align escaped newlines as far left as possible
\r
38 AlignEscapedNewlines: Left
\r
40 # Align operands of binary and ternary expressions
\r
41 # int aaa = bbbbbbbbbbb +
\r
45 # Don't align trailing comments
\r
46 # int a; // Comment a
\r
47 # int b = 2; // Comment b
\r
48 AlignTrailingComments: false
\r
50 # By default don't allow putting parameters onto the next line
\r
51 # myFunction(foo, bar, baz);
\r
52 AllowAllParametersOfDeclarationOnNextLine: false
\r
54 # Don't allow short braced statements to be on a single line
\r
55 # if (a) not if (a) return;
\r
57 AllowShortBlocksOnASingleLine: false
\r
58 AllowShortCaseLabelsOnASingleLine: false
\r
59 AllowShortFunctionsOnASingleLine: Inline
\r
60 AllowShortIfStatementsOnASingleLine: false
\r
61 AllowShortLoopsOnASingleLine: false
\r
63 # But allow short lambdas on a single line
\r
64 AllowShortLambdasOnASingleLine: All
\r
66 # By default don't add a line break after the return type of top-level functions
\r
68 AlwaysBreakAfterReturnType: None
\r
70 # Pack as many parameters or arguments onto the same line as possible
\r
71 # int myFunction(int aaaaaaaaaaaa, int bbbbbbbb,
\r
73 BinPackArguments: true
\r
74 BinPackParameters: true
\r
76 # Attach braces to surrounding context except break before braces on function
\r
87 BreakBeforeBraces: Custom
\r
91 AfterCaseLabel: true
\r
92 SplitEmptyFunction: false
\r
94 AfterControlStatement: true
\r
96 AfterNamespace: true
\r
98 AfterExternBlock: true
\r
101 #BeforeLambdaBody, not supported by VS2019
\r
103 # The constructor initializers style to use.
\r
107 BreakConstructorInitializers: BeforeComma
\r
108 BreakInheritanceList: BeforeComma
\r
110 # Break after operators
\r
111 # int valuve = aaaaaaaaaaaaa +
\r
114 BreakBeforeBinaryOperators: None
\r
115 BreakBeforeTernaryOperators: false
\r
117 # Don't break string literals
\r
118 BreakStringLiterals: false
\r
120 # Re-check: IndentCaseBlocks (not supported in VS2019)
\r
122 # Use the same indentation level as for the switch statement.
\r
123 # Switch statement body is always indented one level more than case labels.
\r
124 IndentCaseLabels: false
\r
126 # Don't indent a function definition or declaration if it is wrapped after the
\r
128 IndentWrappedFunctionNames: false
\r
130 # Align pointer to the left
\r
132 PointerAlignment: Left
\r
134 # Don't insert a space after a cast
\r
135 # x = (int32)y; not x = (int32) y;
\r
136 SpaceAfterCStyleCast: false
\r
138 # Insert spaces before and after assignment operators
\r
139 # int a = 5; not int a=5;
\r
141 SpaceBeforeAssignmentOperators: true
\r
143 # Put a space before opening parentheses only after control statement keywords.
\r
151 SpaceBeforeParens: ControlStatements
\r
153 # Don't insert spaces inside empty '()'
\r
154 SpaceInEmptyParentheses: false
\r
156 # The number of spaces before trailing line comments (// - comments).
\r
157 # This does not affect trailing block comments (/* - comments).
\r
158 SpacesBeforeTrailingComments: 1
\r
160 # Don't insert spaces in casts
\r
161 # x = (int32) y; not x = ( int32 ) y;
\r
162 SpacesInCStyleCastParentheses: false
\r
164 # Insert spaces inside container literals
\r
165 # var arr = [ 1, 2, 3 ]; not var arr = [1, 2, 3];
\r
166 SpacesInContainerLiterals: true
\r
168 # Don't insert spaces after '(' or before ')'
\r
169 # f(arg); not f( arg );
\r
170 SpacesInParentheses: false
\r
172 # Don't insert spaces after '[' or before ']'
\r
173 # int a[5]; not int a[ 5 ];
\r
174 SpacesInSquareBrackets: false
\r
176 # Insert a space after '{' and before '}' in struct initializers
\r
177 Cpp11BracedListStyle: false
\r
179 # A list of macros that should be interpreted as foreach loops instead of as
\r
181 #ForEachMacros: ['for_each_string_list_item']
\r
183 # The maximum number of consecutive empty lines to keep.
\r
184 MaxEmptyLinesToKeep: 1
\r
186 # No empty line at the start of a block.
\r
187 KeepEmptyLinesAtTheStartOfBlocks: false
\r
189 # Don't sort #include's
\r
190 SortIncludes: false
\r
192 # Don't insert spaces after < and before > in template argument lists
\r
193 # static_cast<int>(arg);
\r
194 # std::function<void(int)> fct;
\r
195 SpacesInAngles: false
\r
197 # Indent certain blocks
\r
198 MacroBlockBegin: "^BEGIN_MESSAGE_MAP|BEGIN_TEMPLATE_MESSAGE_MAP"
\r
199 MacroBlockEnd: "^END_MESSAGE_MAP"
\r
201 #BreakTemplateDeclarationsStyle: Yes # not yet supported by VS2017
\r