xref: /openbmc/docs/style/cpp/.clang-format (revision 669d6fdd34a76eb78a280b6701e4eac9a5a9c37c)
1 ---
2 Language:        Cpp
3 # BasedOnStyle:  LLVM
4 AccessModifierOffset: -2
5 AlignAfterOpenBracket: Align
6 AlignConsecutiveAssignments: false
7 AlignConsecutiveDeclarations: false
8 AlignEscapedNewlines: Right
9 AlignOperands:  Align
10 AlignTrailingComments: true
11 AllowAllParametersOfDeclarationOnNextLine: true
12 AllowShortBlocksOnASingleLine: Empty
13 AllowShortCaseLabelsOnASingleLine: false
14 AllowShortFunctionsOnASingleLine: Empty
15 AllowShortIfStatementsOnASingleLine: false
16 AllowShortLoopsOnASingleLine: false
17 AlwaysBreakAfterReturnType: None
18 AlwaysBreakBeforeMultilineStrings: false
19 AlwaysBreakTemplateDeclarations: Yes
20 BinPackArguments: true
21 BinPackParameters: true
22 BraceWrapping:
23   AfterCaseLabel:  true
24   AfterClass:      true
25   AfterControlStatement: true
26   AfterEnum:       true
27   AfterFunction:   true
28   AfterNamespace:  true
29   AfterObjCDeclaration: true
30   AfterStruct:     true
31   AfterUnion:      true
32   AfterExternBlock: true
33   BeforeCatch:     true
34   BeforeElse:      true
35   IndentBraces:    false
36   SplitEmptyFunction:   false
37   SplitEmptyRecord:     false
38   SplitEmptyNamespace:  false
39 BreakBeforeBinaryOperators: None
40 BreakBeforeBraces: Custom
41 BreakBeforeTernaryOperators: true
42 BreakConstructorInitializers: AfterColon
43 BreakInheritanceList: AfterColon
44 BreakStringLiterals: false
45 ColumnLimit:     80
46 CommentPragmas:  '^ IWYU pragma:'
47 CompactNamespaces: false
48 ConstructorInitializerAllOnOneLineOrOnePerLine: false
49 ConstructorInitializerIndentWidth: 4
50 ContinuationIndentWidth: 4
51 Cpp11BracedListStyle: true
52 DeriveLineEnding: false
53 DerivePointerAlignment: false
54 PointerAlignment: Left
55 DisableFormat:   false
56 ExperimentalAutoDetectBinPacking: false
57 FixNamespaceComments: true
58 ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
59 IncludeBlocks: Regroup
60 IncludeCategories:
61   - Regex:           '^[<"](gtest|gmock)'
62     Priority:        7
63   - Regex:           '^"config.h"'
64     Priority:        -1
65   - Regex:           '^".*\.h"'
66     Priority:        1
67   - Regex:           '^".*\.hpp"'
68     Priority:        2
69   - Regex:           '^<.*\.h>'
70     Priority:        3
71   - Regex:           '^<.*\.hpp>'
72     Priority:        4
73   - Regex:           '^<.*'
74     Priority:        5
75   - Regex:           '.*'
76     Priority:        6
77 IndentCaseLabels: true
78 IndentRequiresClause: true
79 IndentWidth:     4
80 IndentWrappedFunctionNames: true
81 KeepEmptyLinesAtTheStartOfBlocks: false
82 LambdaBodyIndentation: OuterScope
83 MacroBlockBegin: ''
84 MacroBlockEnd:   ''
85 MaxEmptyLinesToKeep: 1
86 NamespaceIndentation: None
87 ObjCBlockIndentWidth: 2
88 ObjCSpaceAfterProperty: false
89 ObjCSpaceBeforeProtocolList: true
90 PenaltyBreakAssignment: 25
91 PenaltyBreakBeforeFirstCallParameter: 19
92 PenaltyBreakComment: 300
93 PenaltyBreakFirstLessLess: 120
94 PenaltyBreakString: 1000
95 PenaltyExcessCharacter: 1000000
96 PenaltyReturnTypeOnItsOwnLine: 60
97 PenaltyIndentedWhitespace: 0
98 QualifierAlignment: Left
99 ReferenceAlignment: Left
100 ReflowComments:  true
101 RequiresClausePosition: OwnLine
102 SortIncludes:    true
103 SortUsingDeclarations: true
104 SpaceAfterCStyleCast: false
105 SpaceAfterTemplateKeyword: true
106 SpaceBeforeAssignmentOperators: true
107 SpaceBeforeCpp11BracedList: false
108 SpaceBeforeCtorInitializerColon: true
109 SpaceBeforeInheritanceColon: true
110 SpaceBeforeParens: ControlStatements
111 SpaceBeforeRangeBasedForLoopColon: true
112 SpaceInEmptyParentheses: false
113 SpacesBeforeTrailingComments: 1
114 SpacesInAngles:  false
115 SpacesInContainerLiterals: true
116 SpacesInCStyleCastParentheses: false
117 SpacesInParentheses: false
118 SpacesInSquareBrackets: false
119 Standard:        Latest
120 TabWidth:        4
121 UseCRLF: false
122 UseTab:          Never
123 ...
124 
125