1+ # tab settings
12UseTab : Never
23TabWidth : 4
3- AccessModifierOffset : -4
4+
5+ # indent settings
46IndentWidth : 4
57ObjCBlockIndentWidth : 4
6- ContinuationIndentWidth : 4
8+ AccessModifierOffset : -4 # public: private: protected: indent
9+ ContinuationIndentWidth : 4 # 行延长缩进
710MaxEmptyLinesToKeep : 1
11+ IndentCaseLabels : false
12+ IndentExternBlock : NoIndent # extern "c" indent
813
14+ # allow `if (a) xxx;` AND `if (a) { xxx }``
915AllowShortIfStatementsOnASingleLine : true
1016AllowShortBlocksOnASingleLine : true
1117
18+ # align settings
1219AlignConsecutiveAssignments : false
1320AlignConsecutiveDeclarations : false
1421AlignTrailingComments : true
15- SpacesBeforeTrailingComments : 1
16- SpacesInSquareBrackets : false
17- IndentCaseLabels : false
18- SpaceBeforeAssignmentOperators : true
19-
20- # 关键设置:正常代码使用固定缩进,宏内部特殊处理
21- AlignAfterOpenBracket : DontAlign
22+ AlignAfterOpenBracket : BlockIndent
2223AlignOperands : DontAlign
23- BinPackArguments : false
24- BinPackParameters : false
24+ AlignEscapedNewlinesLeft : true
2525
26- BreakConstructorInitializersBeforeComma : true
26+ # space settings
27+ SpacesBeforeTrailingComments : 1
28+ SpacesInSquareBrackets : false
2729SpaceAfterCStyleCast : false
2830SpaceBeforeParens : ControlStatements
2931SpaceBeforeRangeBasedForLoopColon : true
3032SpaceInEmptyParentheses : false
33+ SpaceBeforeAssignmentOperators : true
34+
35+ # break settings
36+ BreakConstructorInitializers : BeforeComma # 多行构造初始化列表样式
37+ BreakInheritanceList : BeforeComma # 多行继承样式
38+
39+ # sort settings
3140SortUsingDeclarations : false
3241
42+ # disable column limit, prefer control it manually
3343ColumnLimit : 0
44+
45+ # int*, int&
3446PointerAlignment : Left
3547ReferenceAlignment : Left
48+
49+ # allow multi line params like
50+ # int func(
51+ # int a,
52+ # int b,
53+ # int c
54+ # )
3655AllowAllParametersOfDeclarationOnNextLine : true
37- AlignEscapedNewlinesLeft : true
3856
57+ # multiline binary expr syntax, our style:
58+ # a && b ||
59+ # c && d
3960BreakBeforeBinaryOperators : None
61+
62+ # multiline cond ? a : b, our style:
63+ # cond ?
64+ # a :
65+ # b
4066BreakBeforeTernaryOperators : false
4167
68+ # can we write params in single line, our style:
69+ # func(
70+ # xxxx, xxx,
71+ # xxxxx
72+ # xxxxx
73+ # )
74+ BinPackArguments : true
75+ BinPackParameters : BinPack
76+
77+ # do not control #if xxx, let user control it
4278IndentPPDirectives : BeforeHash
4379
80+ # brace break
4481BreakBeforeBraces : Custom
4582BraceWrapping :
83+ # type & namespace
4684 AfterClass : true
4785 AfterStruct : true
4886 AfterEnum : true
4987 AfterNamespace : true
5088 AfterUnion : true
51- AfterFunction : true
89+ # if while for...
90+ AfterControlStatement : true
5291 BeforeElse : true
92+ BeforeWhile : true
93+ # function
94+ AfterFunction : true
95+ # lambda
96+ BeforeLambdaBody : false
5397 IndentBraces : false
5498 AfterExternBlock : false
55- AfterControlStatement : true
99+
100+ # func({ 1, 2, 3 })
56101Cpp11BracedListStyle : false
57102
103+ # try to keep require in single line
58104RequiresClausePosition : SingleLine
59105
60- # 宏特殊处理
106+ # keep attribute itself
107+ BreakAfterAttributes : Leave
108+
109+ # do not sort includes
110+ SortIncludes : false
111+
112+ # ======================== marco process
113+
114+ # marcos treat as attribute
61115AttributeMacros :
62116 - " SUGOI_UNLIKELY"
63117 - " SUGOI_FORCEINLINE"
64118 - " FORCEINLINE"
65119 - " SKR_ALIGNAS"
66120
67121WhitespaceSensitiveMacros :
68- - " spush_attr"
69- - " spop_attr"
70- - " sreflect_enum"
71- - " sreflect_struct"
72- - " sreflect_enum_class"
73- - " sreflect_interface"
74- - " sreflect_function"
75-
76- # 告诉 clang-format 这些宏是语句宏
77- StatementMacros :
78122 - " sattr"
79- - " sreflect_struct"
80- - " sreflect_enum"
81- - " sreflect_enum_class"
82- - " sreflect_interface"
83- - " sreflect_function"
84- - " sreflect_managed_component"
85-
86- ForEachMacros : ["forloop"]
87-
88- BreakAfterAttributes : Leave
89- IndentExternBlock : NoIndent
90-
91- # 特殊处理:不要重新格式化宏块
92- ReflowComments : false
93-
94- # 保持原有的换行
95- KeepEmptyLinesAtTheStartOfBlocks : true
96-
97- SortIncludes : false
123+ # using flag
124+ - sfinal_alias
125+ # param flag
126+ - sparam_in
127+ - sparam_out
128+ - sparam_inout
129+ # rttr api
130+ - " srttr_flag"
131+ - " srttr_attr"
132+ # script api
133+ - sscript_visible
134+ - sscript_newable
135+ - sscript_mapping
136+ - sscript_mixin
137+ - sscript_getter
138+ - sscript_setter
139+
140+ Macros :
141+ # using flag
142+ - sfinal_alias=clang::annotate("")
143+
144+ # param flags
145+ - sparam_in=clang::annotate("")
146+ - sparam_out=clang::annotate("")
147+ - sparam_inout=clang::annotate("")
148+
149+ # script api
150+ - sscript_visible=clang::annotate("")
151+ - sscript_newable=clang::annotate("")
152+ - sscript_mapping=clang::annotate("")
153+ - sscript_mixin=clang::annotate("")
154+ - sscript_getter(x)=clang::annotate("")
155+ - sscript_setter(x)=clang::annotate("")
156+
157+ # attr
158+ - sattr(x)=clang::annotate("")
159+ - sattr(x,y)=clang::annotate("")
160+ - sattr(x,y,z)=clang::annotate("")
161+ - sattr(x,y,z,w)=clang::annotate("")
162+ - sattr(x,y,z,w,a)=clang::annotate("")
163+ - sattr(x,y,z,w,a,b)=clang::annotate("")
164+ - sattr(x,y,z,w,a,b,c)=clang::annotate("")
165+ - sattr(x,y,z,w,a,b,c,d)=clang::annotate("")
166+ - sattr(x,y,z,w,a,b,c,d,e)=clang::annotate("")
167+
168+ # srttr_flag
169+ - srttr_flag(x)=clang::annotate("")
170+ # srttr_attr
171+ - srttr_attr(x)=clang::annotate("")
172+ - srttr_attr(x,y)=clang::annotate("")
173+ - srttr_attr(x,y,z)=clang::annotate("")
174+ - srttr_attr(x,y,z,w)=clang::annotate("")
175+ - srttr_attr(x,y,z,w,a)=clang::annotate("")
176+ - srttr_attr(x,y,z,w,a,b)=clang::annotate("")
177+ - srttr_attr(x,y,z,w,a,b,c)=clang::annotate("")
178+ - srttr_attr(x,y,z,w,a,b,c,d)=clang::annotate("")
179+ - srttr_attr(x,y,z,w,a,b,c,d,e)=clang::annotate("")
180+
181+ ForEachMacros :
182+ - " forloop"
0 commit comments