From 94f8da7b7ba14e6099d765605f5e7497346099ac Mon Sep 17 00:00:00 2001 From: "rick.chan" Date: Tue, 12 Sep 2023 14:44:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A0=BC=E5=BC=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: rick.chan --- .../Clang/Clang_Format_自定义风格.md | 81 ++++++++++++------- 1 file changed, 51 insertions(+), 30 deletions(-) diff --git a/Software/Applications/Clang/Clang_Format_自定义风格.md b/Software/Applications/Clang/Clang_Format_自定义风格.md index 817aa38..6bb482c 100644 --- a/Software/Applications/Clang/Clang_Format_自定义风格.md +++ b/Software/Applications/Clang/Clang_Format_自定义风格.md @@ -5,10 +5,34 @@ Language: Cpp BasedOnStyle: Google AccessModifierOffset: -1 AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: None -AlignOperands: 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 +AlignOperands: AlignAfterOperator +AlignTrailingComments: + Kind: Always + OverEmptyLines: 2 AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: Empty AllowShortCaseLabelsOnASingleLine: false @@ -19,42 +43,35 @@ AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakTemplateDeclarations: Yes AlignArrayOfStructures: Right -BinPackArguments: false -BreakBeforeBraces: Custom -BraceWrapping: - AfterCaseLabel: true - AfterClass: true - AfterStruct: true - AfterControlStatement: Always - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterObjCDeclaration: true - AfterUnion: true - AfterExternBlock: true - BeforeCatch: true - BeforeElse: true - BeforeLambdaBody: true - BeforeWhile: true - IndentBraces: false - SplitEmptyFunction: true - SplitEmptyRecord: true - SplitEmptyNamespace: true -BreakBeforeBinaryOperators: None +BinPackArguments: true +BinPackParameters: false +BitFieldColonSpacing: Before +BreakBeforeBraces: Allman +BreakBeforeBinaryOperators: NonAssignment BreakBeforeTernaryOperators: true -BreakConstructorInitializers: BeforeColon -BreakInheritanceList: BeforeColon +BreakArrays: false +BreakBeforeInlineASMColon: OnlyMultiline +BreakConstructorInitializers: BeforeComma +BreakInheritanceList: BeforeComma +BreakStringLiterals: true ColumnLimit: 80 CompactNamespaces: false ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: false # Make sure the * or & align on the left -EmptyLineBeforeAccessModifier: LogicalBlock +EmptyLineBeforeAccessModifier: Always FixNamespaceComments: true -IncludeBlocks: Preserve -IndentCaseLabels: true +IncludeBlocks: Regroup +IndentCaseLabels: false IndentPPDirectives: None IndentWidth: 4 +IndentAccessModifiers: false +IndentCaseBlocks: false +IndentExternBlock: NoIndent +IndentGotoLabels: false +IndentRequiresClause: false +IndentWrappedFunctionNames: false +InsertBraces: true KeepEmptyLinesAtTheStartOfBlocks: true MaxEmptyLinesToKeep: 1 NamespaceIndentation: None @@ -84,3 +101,7 @@ Standard: c++11 TabWidth: 4 UseTab: Never ``` + +## 外部参考资料 + +1. [Clang 18.0.0git documentation](https://clang.llvm.org/docs/ClangFormatStyleOptions.html)