Skip to content

Commit d5c1192

Browse files
committed
add clang format file for clang-format source formatting
1 parent 735d0fa commit d5c1192

File tree

2 files changed

+180
-0
lines changed

2 files changed

+180
-0
lines changed

.clang-format

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlinesLeft: false
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: All
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: false
21+
BinPackArguments: true
22+
BinPackParameters: true
23+
BraceWrapping:
24+
AfterClass: true
25+
AfterControlStatement: false
26+
AfterEnum: false
27+
AfterFunction: true
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: false
31+
AfterUnion: false
32+
BeforeCatch: false
33+
BeforeElse: false
34+
IndentBraces: false
35+
BreakBeforeBinaryOperators: None
36+
BreakBeforeBraces: Attach
37+
BreakBeforeTernaryOperators: true
38+
BreakConstructorInitializersBeforeComma: false
39+
ColumnLimit: 500
40+
CommentPragmas: '^ IWYU pragma:'
41+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
42+
ConstructorInitializerIndentWidth: 4
43+
ContinuationIndentWidth: 4
44+
Cpp11BracedListStyle: true
45+
DerivePointerAlignment: false
46+
DisableFormat: false
47+
ExperimentalAutoDetectBinPacking: false
48+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
49+
IncludeCategories:
50+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
51+
Priority: 2
52+
- Regex: '^(<|"(gtest|isl|json)/)'
53+
Priority: 3
54+
- Regex: '.*'
55+
Priority: 1
56+
IndentCaseLabels: false
57+
IndentWidth: 4
58+
IndentWrappedFunctionNames: false
59+
KeepEmptyLinesAtTheStartOfBlocks: true
60+
MacroBlockBegin: ''
61+
MacroBlockEnd: ''
62+
MaxEmptyLinesToKeep: 1
63+
NamespaceIndentation: None
64+
ObjCBlockIndentWidth: 4
65+
ObjCSpaceAfterProperty: false
66+
ObjCSpaceBeforeProtocolList: true
67+
PenaltyBreakBeforeFirstCallParameter: 19
68+
PenaltyBreakComment: 300
69+
PenaltyBreakFirstLessLess: 120
70+
PenaltyBreakString: 1000
71+
PenaltyExcessCharacter: 1000000
72+
PenaltyReturnTypeOnItsOwnLine: 60
73+
PointerAlignment: Right
74+
ReflowComments: true
75+
SortIncludes: true
76+
SpaceAfterCStyleCast: false
77+
SpaceBeforeAssignmentOperators: true
78+
SpaceBeforeParens: ControlStatements
79+
SpaceInEmptyParentheses: false
80+
SpacesBeforeTrailingComments: 1
81+
SpacesInAngles: false
82+
SpacesInContainerLiterals: true
83+
SpacesInCStyleCastParentheses: false
84+
SpacesInParentheses: false
85+
SpacesInSquareBrackets: false
86+
Standard: Cpp11
87+
TabWidth: 4
88+
UseTab: Always
89+
...
90+

clang-format

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlinesLeft: false
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: All
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: false
21+
BinPackArguments: true
22+
BinPackParameters: true
23+
BraceWrapping:
24+
AfterClass: true
25+
AfterControlStatement: false
26+
AfterEnum: false
27+
AfterFunction: true
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: false
31+
AfterUnion: false
32+
BeforeCatch: false
33+
BeforeElse: false
34+
IndentBraces: false
35+
BreakBeforeBinaryOperators: None
36+
BreakBeforeBraces: Attach
37+
BreakBeforeTernaryOperators: true
38+
BreakConstructorInitializersBeforeComma: false
39+
ColumnLimit: 500
40+
CommentPragmas: '^ IWYU pragma:'
41+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
42+
ConstructorInitializerIndentWidth: 4
43+
ContinuationIndentWidth: 4
44+
Cpp11BracedListStyle: true
45+
DerivePointerAlignment: false
46+
DisableFormat: false
47+
ExperimentalAutoDetectBinPacking: false
48+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
49+
IncludeCategories:
50+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
51+
Priority: 2
52+
- Regex: '^(<|"(gtest|isl|json)/)'
53+
Priority: 3
54+
- Regex: '.*'
55+
Priority: 1
56+
IndentCaseLabels: false
57+
IndentWidth: 4
58+
IndentWrappedFunctionNames: false
59+
KeepEmptyLinesAtTheStartOfBlocks: true
60+
MacroBlockBegin: ''
61+
MacroBlockEnd: ''
62+
MaxEmptyLinesToKeep: 1
63+
NamespaceIndentation: None
64+
ObjCBlockIndentWidth: 4
65+
ObjCSpaceAfterProperty: false
66+
ObjCSpaceBeforeProtocolList: true
67+
PenaltyBreakBeforeFirstCallParameter: 19
68+
PenaltyBreakComment: 300
69+
PenaltyBreakFirstLessLess: 120
70+
PenaltyBreakString: 1000
71+
PenaltyExcessCharacter: 1000000
72+
PenaltyReturnTypeOnItsOwnLine: 60
73+
PointerAlignment: Right
74+
ReflowComments: true
75+
SortIncludes: true
76+
SpaceAfterCStyleCast: false
77+
SpaceBeforeAssignmentOperators: true
78+
SpaceBeforeParens: ControlStatements
79+
SpaceInEmptyParentheses: false
80+
SpacesBeforeTrailingComments: 1
81+
SpacesInAngles: false
82+
SpacesInContainerLiterals: true
83+
SpacesInCStyleCastParentheses: false
84+
SpacesInParentheses: false
85+
SpacesInSquareBrackets: false
86+
Standard: Cpp11
87+
TabWidth: 4
88+
UseTab: Always
89+
...
90+

0 commit comments

Comments
 (0)