parent
94f8da7b7b
commit
ab7cc1e471
|
@ -1,107 +1,107 @@
|
||||||
# Clang Format 自定义风格
|
# Clang Format 自定义风格
|
||||||
|
|
||||||
```js
|
```js
|
||||||
Language: Cpp
|
|
||||||
BasedOnStyle: Google
|
BasedOnStyle: Google
|
||||||
AccessModifierOffset: -1
|
AccessModifierOffset: '-1'
|
||||||
AlignAfterOpenBracket: Align
|
AlignAfterOpenBracket: Align
|
||||||
AlignConsecutiveAssignments:
|
|
||||||
Enabled: true
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignConsecutiveBitFields:
|
|
||||||
Enabled: true
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignConsecutiveDeclarations:
|
|
||||||
Enabled: true
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignConsecutiveMacros:
|
|
||||||
Enabled: true
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
# clang-format 17
|
|
||||||
# AlignConsecutiveShortCaseStatements:
|
|
||||||
# Enabled: true
|
|
||||||
# AcrossEmptyLines: false
|
|
||||||
# AcrossComments: false
|
|
||||||
# AlignCaseColons: false
|
|
||||||
AlignEscapedNewlines: Left
|
AlignEscapedNewlines: Left
|
||||||
AlignOperands: AlignAfterOperator
|
AlignOperands: 'true'
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: 'false'
|
||||||
|
AllowShortBlocksOnASingleLine: Empty
|
||||||
|
AllowShortCaseLabelsOnASingleLine: 'false'
|
||||||
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLambdasOnASingleLine: Inline
|
||||||
|
AllowShortLoopsOnASingleLine: 'false'
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakTemplateDeclarations: 'Yes'
|
||||||
|
BinPackArguments: 'true'
|
||||||
|
BinPackParameters: 'false'
|
||||||
|
BreakBeforeTernaryOperators: 'true'
|
||||||
|
BreakArrays: 'false'
|
||||||
|
CompactNamespaces: 'false'
|
||||||
|
BreakBeforeInlineASMColon: OnlyMultiline
|
||||||
|
BreakBeforeBinaryOperators: NonAssignment
|
||||||
|
BitFieldColonSpacing: Before
|
||||||
|
# AlignArrayOfStructures: Right
|
||||||
|
AlignConsecutiveAssignments:
|
||||||
|
Enabled: 'true'
|
||||||
|
AcrossEmptyLines: 'false'
|
||||||
|
AcrossComments: 'false'
|
||||||
|
AlignConsecutiveBitFields:
|
||||||
|
Enabled: 'true'
|
||||||
|
AcrossEmptyLines: 'false'
|
||||||
|
AcrossComments: 'false'
|
||||||
|
AlignConsecutiveDeclarations:
|
||||||
|
Enabled: 'true'
|
||||||
|
AcrossEmptyLines: 'false'
|
||||||
|
AcrossComments: 'false'
|
||||||
|
AlignConsecutiveMacros:
|
||||||
|
Enabled: 'true'
|
||||||
|
AcrossEmptyLines: 'false'
|
||||||
|
AcrossComments: 'false'
|
||||||
AlignTrailingComments:
|
AlignTrailingComments:
|
||||||
Kind: Always
|
Kind: Always
|
||||||
OverEmptyLines: 2
|
OverEmptyLines: 2
|
||||||
AllowAllArgumentsOnNextLine: true
|
BreakBeforeBraces: Custom
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false
|
BraceWrapping:
|
||||||
AllowShortBlocksOnASingleLine: Empty
|
AfterCaseLabel: 'true'
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
AfterClass: 'true'
|
||||||
AllowShortFunctionsOnASingleLine: Inline
|
AfterStruct: 'true'
|
||||||
AllowShortIfStatementsOnASingleLine: Never # To avoid conflict, set this "Never" and each "if statement" should include brace when coding
|
AfterControlStatement: Always
|
||||||
AllowShortLambdasOnASingleLine: Inline
|
AfterEnum: 'true'
|
||||||
AllowShortLoopsOnASingleLine: false
|
AfterFunction: 'true'
|
||||||
AlwaysBreakAfterReturnType: None
|
AfterNamespace: 'true'
|
||||||
AlwaysBreakTemplateDeclarations: Yes
|
AfterObjCDeclaration: 'true'
|
||||||
AlignArrayOfStructures: Right
|
AfterUnion: 'true'
|
||||||
BinPackArguments: true
|
AfterExternBlock: 'true'
|
||||||
BinPackParameters: false
|
BeforeCatch: 'true'
|
||||||
BitFieldColonSpacing: Before
|
BeforeElse: 'true'
|
||||||
BreakBeforeBraces: Allman
|
BeforeLambdaBody: 'true'
|
||||||
BreakBeforeBinaryOperators: NonAssignment
|
BeforeWhile: 'true'
|
||||||
BreakBeforeTernaryOperators: true
|
IndentBraces: false
|
||||||
BreakArrays: false
|
SplitEmptyFunction: 'true'
|
||||||
BreakBeforeInlineASMColon: OnlyMultiline
|
SplitEmptyRecord: 'true'
|
||||||
|
SplitEmptyNamespace: 'true'
|
||||||
|
InsertBraces: 'true'
|
||||||
|
AllowAllArgumentsOnNextLine: 'true'
|
||||||
BreakConstructorInitializers: BeforeComma
|
BreakConstructorInitializers: BeforeComma
|
||||||
BreakInheritanceList: BeforeComma
|
BreakInheritanceList: BeforeComma
|
||||||
BreakStringLiterals: true
|
BreakStringLiterals: 'true'
|
||||||
ColumnLimit: 80
|
ColumnLimit: '80'
|
||||||
CompactNamespaces: false
|
ContinuationIndentWidth: '4'
|
||||||
ContinuationIndentWidth: 4
|
|
||||||
Cpp11BracedListStyle: true
|
|
||||||
DerivePointerAlignment: false # Make sure the * or & align on the left
|
|
||||||
EmptyLineBeforeAccessModifier: Always
|
|
||||||
FixNamespaceComments: true
|
|
||||||
IncludeBlocks: Regroup
|
IncludeBlocks: Regroup
|
||||||
IndentCaseLabels: false
|
IndentCaseLabels: 'false'
|
||||||
IndentPPDirectives: None
|
IndentPPDirectives: None
|
||||||
IndentWidth: 4
|
IndentWidth: '4'
|
||||||
IndentAccessModifiers: false
|
Language: Cpp
|
||||||
IndentCaseBlocks: false
|
MaxEmptyLinesToKeep: '1'
|
||||||
IndentExternBlock: NoIndent
|
|
||||||
IndentGotoLabels: false
|
|
||||||
IndentRequiresClause: false
|
|
||||||
IndentWrappedFunctionNames: false
|
|
||||||
InsertBraces: true
|
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
|
||||||
MaxEmptyLinesToKeep: 1
|
|
||||||
NamespaceIndentation: None
|
NamespaceIndentation: None
|
||||||
ObjCSpaceAfterProperty: false
|
|
||||||
ObjCSpaceBeforeProtocolList: true
|
|
||||||
PointerAlignment: Left
|
PointerAlignment: Left
|
||||||
ReflowComments: false
|
SortIncludes: 'true'
|
||||||
# SeparateDefinitionBlocks: Always # Only support since clang-format 14
|
SortUsingDeclarations: 'true'
|
||||||
SpaceAfterCStyleCast: false
|
SpaceAfterCStyleCast: 'false'
|
||||||
SpaceAfterLogicalNot: false
|
SpaceAfterLogicalNot: 'false'
|
||||||
SpaceAfterTemplateKeyword: true
|
SpaceAfterTemplateKeyword: 'false'
|
||||||
SpaceBeforeAssignmentOperators: true
|
SpaceBeforeAssignmentOperators: 'true'
|
||||||
SpaceBeforeCpp11BracedList: false
|
SpaceBeforeCpp11BracedList: 'true'
|
||||||
SpaceBeforeCtorInitializerColon: true
|
SpaceBeforeCtorInitializerColon: 'true'
|
||||||
SpaceBeforeInheritanceColon: true
|
SpaceBeforeInheritanceColon: 'true'
|
||||||
SpaceBeforeParens: ControlStatements
|
SpaceBeforeParens: ControlStatements
|
||||||
SpaceBeforeRangeBasedForLoopColon: true
|
SpaceBeforeRangeBasedForLoopColon: 'true'
|
||||||
SpaceBeforeSquareBrackets: false
|
SpaceInEmptyParentheses: 'false'
|
||||||
SpaceInEmptyParentheses: false
|
SpacesBeforeTrailingComments: '2'
|
||||||
SpacesBeforeTrailingComments: 2
|
SpacesInAngles: 'false'
|
||||||
SpacesInAngles: false
|
SpacesInCStyleCastParentheses: 'false'
|
||||||
SpacesInCStyleCastParentheses: false
|
SpacesInContainerLiterals: 'true'
|
||||||
SpacesInContainerLiterals: false
|
SpacesInParentheses: 'false'
|
||||||
SpacesInParentheses: false
|
SpacesInSquareBrackets: 'false'
|
||||||
SpacesInSquareBrackets: false
|
Standard: Cpp11
|
||||||
Standard: c++11
|
TabWidth: '4'
|
||||||
TabWidth: 4
|
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
```
|
```
|
||||||
|
|
||||||
## 外部参考资料
|
## 外部参考资料
|
||||||
|
|
||||||
1. [Clang 18.0.0git documentation](https://clang.llvm.org/docs/ClangFormatStyleOptions.html)
|
1. [Clang 18.0.0git documentation](https://clang.llvm.org/docs/ClangFormatStyleOptions.html)
|
||||||
|
2. [](https://zed0.co.uk/clang-format-configurator/)
|
||||||
|
|
Loading…
Reference in New Issue