Skip to content

Commit fab5d30

Browse files
authored
llama : add .clang-format file (ggml-org#10415)
1 parent 8fd4b7f commit fab5d30

File tree

2 files changed

+551
-312
lines changed

2 files changed

+551
-312
lines changed

.clang-format

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
Language: Cpp
3+
AlignAfterOpenBracket: Align
4+
AlignArrayOfStructures: Left
5+
AlignConsecutiveAssignments: AcrossComments
6+
AlignConsecutiveBitFields: AcrossComments
7+
AlignConsecutiveDeclarations: AcrossComments
8+
AlignConsecutiveMacros: AcrossComments
9+
# AlignConsecutiveShortCaseStatements: AcrossComments
10+
AlignEscapedNewlines: Left # LeftWithLastLine
11+
AlignOperands: Align
12+
AlignTrailingComments:
13+
Kind: Always
14+
OverEmptyLines: 1
15+
AllowAllArgumentsOnNextLine: true
16+
AllowAllParametersOfDeclarationOnNextLine: false
17+
# AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
18+
AllowShortBlocksOnASingleLine: Never
19+
AllowShortCaseLabelsOnASingleLine: false
20+
AllowShortFunctionsOnASingleLine: Inline
21+
AllowShortIfStatementsOnASingleLine: Never
22+
AllowShortLambdasOnASingleLine: Inline
23+
AllowShortLoopsOnASingleLine: false
24+
AlwaysBreakBeforeMultilineStrings: true
25+
BinPackArguments: true
26+
BinPackParameters: true # OnePerLine
27+
BitFieldColonSpacing: Both
28+
BreakBeforeBraces: Custom # Attach
29+
BraceWrapping:
30+
AfterCaseLabel: true
31+
AfterClass: false
32+
AfterControlStatement: false
33+
AfterEnum: false
34+
AfterFunction: false
35+
AfterNamespace: false
36+
AfterObjCDeclaration: false
37+
AfterStruct: false
38+
AfterUnion: false
39+
AfterExternBlock: false
40+
BeforeCatch: false
41+
BeforeElse: false
42+
BeforeLambdaBody: false
43+
BeforeWhile: false
44+
IndentBraces: false
45+
SplitEmptyFunction: false
46+
SplitEmptyRecord: false
47+
SplitEmptyNamespace: false
48+
# BreakAdjacentStringLiterals: true
49+
BreakAfterAttributes: Never
50+
BreakBeforeBinaryOperators: None
51+
BreakBeforeInlineASMColon: OnlyMultiline
52+
BreakBeforeTernaryOperators: false
53+
# BreakBinaryOperations: Never
54+
BreakConstructorInitializers: AfterColon
55+
# BreakFunctionDefinitionParameters: false
56+
BreakInheritanceList: AfterComma
57+
BreakStringLiterals: true
58+
# BreakTemplateDeclarations: Yes
59+
ColumnLimit: 120
60+
CommentPragmas: '^ IWYU pragma:'
61+
CompactNamespaces: false
62+
ConstructorInitializerIndentWidth: 4
63+
ContinuationIndentWidth: 4
64+
Cpp11BracedListStyle: false
65+
DerivePointerAlignment: false
66+
DisableFormat: false
67+
EmptyLineBeforeAccessModifier: Leave
68+
EmptyLineAfterAccessModifier: Never
69+
ExperimentalAutoDetectBinPacking: false
70+
FixNamespaceComments: true
71+
IncludeBlocks: Regroup
72+
IncludeCategories:
73+
- Regex: '^<.*\.h>'
74+
Priority: 1
75+
SortPriority: 0
76+
- Regex: '^<.*'
77+
Priority: 2
78+
SortPriority: 0
79+
- Regex: '.*'
80+
Priority: 3
81+
SortPriority: 0
82+
IncludeIsMainRegex: '([-_](test|unittest))?$'
83+
IncludeIsMainSourceRegex: ''
84+
IndentAccessModifiers: false
85+
IndentCaseBlocks: true
86+
IndentCaseLabels: true
87+
IndentExternBlock: NoIndent
88+
IndentGotoLabels: false
89+
IndentPPDirectives: AfterHash
90+
IndentWidth: 4
91+
IndentWrappedFunctionNames: false
92+
InsertBraces: true # NOTE: may lead to incorrect formatting
93+
InsertNewlineAtEOF: true
94+
JavaScriptQuotes: Leave
95+
JavaScriptWrapImports: true
96+
KeepEmptyLinesAtTheStartOfBlocks: false
97+
LambdaBodyIndentation: Signature
98+
LineEnding: LF
99+
MacroBlockBegin: ''
100+
MacroBlockEnd: ''
101+
MaxEmptyLinesToKeep: 1
102+
NamespaceIndentation: None
103+
ObjCBinPackProtocolList: Auto
104+
ObjCBlockIndentWidth: 4
105+
ObjCSpaceAfterProperty: true
106+
ObjCSpaceBeforeProtocolList: true
107+
PPIndentWidth: -1
108+
PackConstructorInitializers: CurrentLine
109+
PenaltyBreakAssignment: 2
110+
PenaltyBreakBeforeFirstCallParameter: 1
111+
PenaltyBreakComment: 300
112+
PenaltyBreakFirstLessLess: 120
113+
PenaltyBreakString: 1000
114+
PenaltyBreakTemplateDeclaration: 10
115+
PenaltyExcessCharacter: 1000000
116+
PenaltyReturnTypeOnItsOwnLine: 200
117+
PointerAlignment: Middle
118+
QualifierAlignment: Left
119+
#QualifierOrder: ['static', 'inline', 'friend', 'constexpr', 'const', 'volatile', 'type', 'restrict']
120+
RawStringFormats:
121+
- Language: Cpp
122+
Delimiters:
123+
- cc
124+
- CC
125+
- cpp
126+
- Cpp
127+
- CPP
128+
- 'c++'
129+
- 'C++'
130+
CanonicalDelimiter: ''
131+
ReferenceAlignment: Middle
132+
ReflowComments: false # IndentOnly
133+
SeparateDefinitionBlocks: Always
134+
SortIncludes: CaseInsensitive
135+
SortUsingDeclarations: LexicographicNumeric
136+
SpaceAfterCStyleCast: true
137+
SpaceAfterLogicalNot: false
138+
SpaceAfterTemplateKeyword: true
139+
SpaceBeforeAssignmentOperators: true
140+
SpaceBeforeCpp11BracedList: false
141+
SpaceBeforeCtorInitializerColon: true
142+
SpaceBeforeInheritanceColon: true
143+
SpaceBeforeParens: ControlStatements
144+
SpaceBeforeRangeBasedForLoopColon: true
145+
SpaceInEmptyBlock: false
146+
SpaceInEmptyParentheses: false
147+
SpacesBeforeTrailingComments: 2
148+
SpacesInAngles: Never
149+
SpacesInContainerLiterals: true
150+
SpacesInLineCommentPrefix:
151+
Minimum: 1
152+
Maximum: -1
153+
SpacesInParentheses: false
154+
SpacesInSquareBrackets: false
155+
SpaceBeforeSquareBrackets: false
156+
Standard: c++17
157+
TabWidth: 4
158+
UseTab: Never
159+
WhitespaceSensitiveMacros: ['STRINGIZE']
160+
...
161+

0 commit comments

Comments
 (0)