2022-12-05 13:52:24 +00:00
|
|
|
|
# Run command below to format a file
|
|
|
|
|
# clang-format -i --style=file <file>
|
|
|
|
|
|
|
|
|
|
# complete clang-format rule, reference:
|
|
|
|
|
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
|
|
|
|
|
|
|
|
|
# WebKit format rule details, reference:
|
|
|
|
|
# https://webkit.org/code-style-guidelines/
|
|
|
|
|
# https://gitee.com/mirrors/WebKit/blob/main/.clang-format
|
2022-03-15 06:28:01 +00:00
|
|
|
|
BasedOnStyle: Webkit
|
2022-12-05 13:52:24 +00:00
|
|
|
|
# works on C and C++ files
|
|
|
|
|
Language: Cpp
|
|
|
|
|
|
2022-03-15 06:28:01 +00:00
|
|
|
|
PointerAlignment: Right
|
|
|
|
|
AlignTrailingComments: true
|
|
|
|
|
AlignConsecutiveMacros: Consecutive
|
2022-12-05 13:52:24 +00:00
|
|
|
|
# case statements indent one layer
|
2022-03-15 06:28:01 +00:00
|
|
|
|
IndentCaseLabels: true
|
|
|
|
|
BreakBeforeBinaryOperators: None
|
|
|
|
|
SpaceBeforeParens: ControlStatementsExceptControlMacros
|
|
|
|
|
SpacesInCStyleCastParentheses: false
|
|
|
|
|
AlignEscapedNewlines: Left
|
|
|
|
|
NamespaceIndentation: None
|
|
|
|
|
FixNamespaceComments: true
|
|
|
|
|
BreakConstructorInitializers: AfterColon
|
|
|
|
|
AlignArrayOfStructures: Left
|
|
|
|
|
AllowShortFunctionsOnASingleLine: Empty
|
|
|
|
|
AllowShortLambdasOnASingleLine: Empty
|
|
|
|
|
AlwaysBreakTemplateDeclarations: true
|
|
|
|
|
BreakBeforeTernaryOperators: false
|
|
|
|
|
SpaceAroundPointerQualifiers: Both
|
2022-12-05 13:52:24 +00:00
|
|
|
|
# iterator macros declaretion,avoid being treated as function call
|
2022-03-15 06:28:01 +00:00
|
|
|
|
ForEachMacros:
|
2022-12-05 13:52:24 +00:00
|
|
|
|
- 'LIST_FOR_EACH_ENTRY'
|
|
|
|
|
- 'LIST_FOR_EACH_ENTRY_SAFE'
|
|
|
|
|
- 'LIST_FOR_EACH'
|
|
|
|
|
- 'LIST_FOR_EACH_SAFE'
|
|
|
|
|
SortIncludes: CaseInsensitive
|
|
|
|
|
AllowShortEnumsOnASingleLine: false
|
|
|
|
|
ColumnLimit: 120
|