From 2f0c107c3b5411fb5cb9d35852111acf46906664 Mon Sep 17 00:00:00 2001 From: Christian Kaiser Date: Thu, 12 Dec 2024 04:47:59 -0300 Subject: [PATCH 01/17] Sort clang-format file --- .clang-format | 79 +++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/.clang-format b/.clang-format index 97a9e6663..504e6b44b 100644 --- a/.clang-format +++ b/.clang-format @@ -1,22 +1,22 @@ --- AccessModifierOffset: -2 AlignAfterOpenBracket: Align -AlignConsecutiveMacros: AcrossEmptyLines AlignConsecutiveAssignments: None AlignConsecutiveBitFields: None AlignConsecutiveDeclarations: None +AlignConsecutiveMacros: AcrossEmptyLines AlignEscapedNewlines: Right -AlignOperands: Align +AlignOperands: Align AlignTrailingComments: true AllowAllArgumentsOnNextLine: true AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true -AllowShortEnumsOnASingleLine: true AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: InlineOnly -AllowShortLambdasOnASingleLine: All AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None @@ -24,35 +24,36 @@ AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: Yes BinPackArguments: false BinPackParameters: false +BitFieldColonSpacing: Both BraceWrapping: - AfterCaseLabel: false - AfterClass: false + AfterCaseLabel: false + AfterClass: false AfterControlStatement: Never - AfterEnum: false - AfterFunction: true - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false + AfterEnum: false AfterExternBlock: false - BeforeCatch: true - BeforeElse: true + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: true + BeforeElse: true BeforeLambdaBody: false - BeforeWhile: false - IndentBraces: false + BeforeWhile: false + IndentBraces: false SplitEmptyFunction: true - SplitEmptyRecord: false SplitEmptyNamespace: false + SplitEmptyRecord: false BreakBeforeBinaryOperators: None -BreakBeforeConceptDeclarations: true BreakBeforeBraces: Custom +BreakBeforeConceptDeclarations: true BreakBeforeInheritanceComma: false -BreakInheritanceList: AfterComma BreakBeforeTernaryOperators: false -BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeComma +BreakConstructorInitializersBeforeComma: false +BreakInheritanceList: AfterComma BreakStringLiterals: false -ColumnLimit: 80 +ColumnLimit: 80 CompactNamespaces: true ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 2 @@ -60,18 +61,18 @@ ContinuationIndentWidth: 2 Cpp11BracedListStyle: false DeriveLineEnding: false DerivePointerAlignment: false -DisableFormat: false +DisableFormat: false EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true -IncludeBlocks: Preserve -IndentCaseLabels: true +IncludeBlocks: Preserve IndentCaseBlocks: false +IndentCaseLabels: true +IndentExternBlock: AfterExternBlock IndentGotoLabels: true IndentPPDirectives: BeforeHash -IndentExternBlock: AfterExternBlock -IndentRequires: false -IndentWidth: 2 +IndentRequires: false +IndentWidth: 2 IndentWrappedFunctionNames: false InsertTrailingCommas: None KeepEmptyLinesAtTheStartOfBlocks: false @@ -89,36 +90,34 @@ PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 1000 PenaltyIndentedWhitespace: 0 +PenaltyReturnTypeOnItsOwnLine: 1000 PointerAlignment: Left -ReflowComments: false -SortIncludes: true +ReflowComments: false +SortIncludes: true SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: false +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements -SpaceAroundPointerQualifiers: Default SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: true SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 2 -SpacesInAngles: false +SpacesInAngles: false +SpacesInCStyleCastParentheses: false SpacesInConditionalStatement: false SpacesInContainerLiterals: false -SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false -BitFieldColonSpacing: Both -Standard: c++17 -TabWidth: 8 -UseCRLF: false -UseTab: Never -... +Standard: c++17 +TabWidth: 8 +UseCRLF: false +UseTab: Never From aff027dcf43cc10f7128a49d6ff6f8eed16aeeef Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 15:52:32 -0300 Subject: [PATCH 02/17] Update clang-format config with --dump-config (clang-format v19.1.5) --- .clang-format | 148 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 124 insertions(+), 24 deletions(-) diff --git a/.clang-format b/.clang-format index 504e6b44b..a507c183b 100644 --- a/.clang-format +++ b/.clang-format @@ -1,27 +1,74 @@ --- AccessModifierOffset: -2 AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: None -AlignConsecutiveBitFields: None -AlignConsecutiveDeclarations: None -AlignConsecutiveMacros: AcrossEmptyLines +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + AcrossComments: false + AcrossEmptyLines: false + AlignCompound: false + AlignFunctionPointers: false + Enabled: false + PadOperators: true +AlignConsecutiveBitFields: + AcrossComments: false + AcrossEmptyLines: false + AlignCompound: false + AlignFunctionPointers: false + Enabled: false + PadOperators: true +AlignConsecutiveDeclarations: + AcrossComments: false + AcrossEmptyLines: false + AlignCompound: false + AlignFunctionPointers: false + Enabled: false + PadOperators: true +AlignConsecutiveMacros: + AcrossComments: false + AcrossEmptyLines: true + AlignCompound: false + AlignFunctionPointers: false + Enabled: true + PadOperators: true +AlignConsecutiveShortCaseStatements: + AcrossComments: false + AcrossEmptyLines: false + AlignCaseArrows: false + AlignCaseColons: false + Enabled: false +AlignConsecutiveTableGenCondOperatorColons: + AcrossComments: false + AcrossEmptyLines: false + AlignCompound: false + AlignFunctionPointers: false + Enabled: false + PadOperators: false +AlignConsecutiveTableGenDefinitionColons: + AcrossComments: false + AcrossEmptyLines: false + AlignCompound: false + AlignFunctionPointers: false + Enabled: false + PadOperators: false AlignEscapedNewlines: Right AlignOperands: Align -AlignTrailingComments: true +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true +AllowBreakBeforeNoexceptSpecifier: Never AllowShortBlocksOnASingleLine: Never +AllowShortCaseExpressionOnASingleLine: true AllowShortCaseLabelsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: InlineOnly AllowShortIfStatementsOnASingleLine: Never AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: Yes BinPackArguments: false BinPackParameters: false BitFieldColonSpacing: Both @@ -42,40 +89,62 @@ BraceWrapping: BeforeWhile: false IndentBraces: false SplitEmptyFunction: true - SplitEmptyNamespace: false SplitEmptyRecord: false + SplitEmptyNamespace: false +BreakAdjacentStringLiterals: true +BreakAfterAttributes: Leave +BreakAfterReturnType: None +BreakArrays: true BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: Always BreakBeforeBraces: Custom -BreakBeforeConceptDeclarations: true -BreakBeforeInheritanceComma: false +BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeTernaryOperators: false BreakConstructorInitializers: BeforeComma -BreakConstructorInitializersBeforeComma: false +BreakFunctionDefinitionParameters: false BreakInheritanceList: AfterComma BreakStringLiterals: false +BreakTemplateDeclarations: Yes ColumnLimit: 80 CompactNamespaces: true -ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 2 ContinuationIndentWidth: 2 Cpp11BracedListStyle: false -DeriveLineEnding: false DerivePointerAlignment: false DisableFormat: false +EmptyLineAfterAccessModifier: Never EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true IncludeBlocks: Preserve +IndentAccessModifiers: false IndentCaseBlocks: false IndentCaseLabels: true IndentExternBlock: AfterExternBlock IndentGotoLabels: true IndentPPDirectives: BeforeHash -IndentRequires: false +IndentRequiresClause: false IndentWidth: 2 IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: false InsertTrailingCommas: None -KeepEmptyLinesAtTheStartOfBlocks: false +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 +KeepEmptyLines: + AtEndOfFile: false + AtStartOfBlock: false + AtStartOfFile: true +LambdaBodyIndentation: Signature +LineEnding: LF +MacroBlockBegin: '' +MacroBlockEnd: '' +MainIncludeChar: Quote MaxEmptyLinesToKeep: 1 NamespaceIndentation: None ObjCBinPackProtocolList: Auto @@ -83,19 +152,33 @@ ObjCBlockIndentWidth: 2 ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: BinPack PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakScopeResolution: 500 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 PenaltyIndentedWhitespace: 0 PenaltyReturnTypeOnItsOwnLine: 1000 PointerAlignment: Left +PPIndentWidth: -1 +QualifierAlignment: Leave +ReferenceAlignment: Pointer ReflowComments: false -SortIncludes: true -SortUsingDeclarations: true +RemoveBracesLLVM: false +RemoveParentheses: Leave +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SkipMacroDefinitionBody: false +SortIncludes: CaseSensitive +SortUsingDeclarations: LexicographicNumeric SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: false @@ -105,19 +188,36 @@ SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterPlacementOperator: true + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: true -SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 2 -SpacesInAngles: false -SpacesInCStyleCastParentheses: false -SpacesInConditionalStatement: false +SpacesInAngles: Never SpacesInContainerLiterals: false -SpacesInParentheses: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParens: Never +SpacesInParensOptions: + ExceptDoubleParentheses: false + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false SpacesInSquareBrackets: false Standard: c++17 TabWidth: 8 -UseCRLF: false UseTab: Never From 8cf1a185b69affd0bd31f965cce9b3e24f640e03 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 16:28:52 -0300 Subject: [PATCH 03/17] [clang-format] Set AlignArrayOfStructures: Left We get better results when defining command Params and scripting structures (methods/properties). --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index a507c183b..405cee86d 100644 --- a/.clang-format +++ b/.clang-format @@ -1,7 +1,7 @@ --- AccessModifierOffset: -2 AlignAfterOpenBracket: Align -AlignArrayOfStructures: None +AlignArrayOfStructures: Left AlignConsecutiveAssignments: AcrossComments: false AcrossEmptyLines: false From 215f22cce3e7cdcb4028415bc7bbb16ead4690ae Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 18:38:53 -0300 Subject: [PATCH 04/17] [clang-format] New ColumnLimit=100 and new penalty weights Making PenaltyBreakAssignment bigger creates better looking const/variable declarations, where the following term to the assignment operator is in the same line. --- .clang-format | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.clang-format b/.clang-format index 405cee86d..d9f744de0 100644 --- a/.clang-format +++ b/.clang-format @@ -105,7 +105,7 @@ BreakFunctionDefinitionParameters: false BreakInheritanceList: AfterComma BreakStringLiterals: false BreakTemplateDeclarations: Yes -ColumnLimit: 80 +ColumnLimit: 100 CompactNamespaces: true ConstructorInitializerIndentWidth: 2 ContinuationIndentWidth: 2 @@ -153,17 +153,17 @@ ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true PackConstructorInitializers: BinPack -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 +PenaltyBreakAssignment: 50 +PenaltyBreakBeforeFirstCallParameter: 2 +PenaltyBreakComment: 30 +PenaltyBreakFirstLessLess: 12 PenaltyBreakOpenParenthesis: 0 PenaltyBreakScopeResolution: 500 -PenaltyBreakString: 1000 -PenaltyBreakTemplateDeclaration: 10 -PenaltyExcessCharacter: 1000000 +PenaltyBreakString: 100 +PenaltyBreakTemplateDeclaration: 1 +PenaltyExcessCharacter: 100 PenaltyIndentedWhitespace: 0 -PenaltyReturnTypeOnItsOwnLine: 1000 +PenaltyReturnTypeOnItsOwnLine: 200 PointerAlignment: Left PPIndentWidth: -1 QualifierAlignment: Leave From b38a3c03eb19a887686fb8e0a696bf111fe47b74 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 19:03:04 -0300 Subject: [PATCH 05/17] [clang-format] Change AllowAllArgumentsOnNextLine=false With this we prefer to format function calls as: int value = function(arg1, arg2, arg3); Or: int value = function(arg1, arg2, arg3); Rather than: int value = function( arg1, arg2, arg3); --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index d9f744de0..eaf54634e 100644 --- a/.clang-format +++ b/.clang-format @@ -55,7 +55,7 @@ AlignOperands: Align AlignTrailingComments: Kind: Always OverEmptyLines: 0 -AllowAllArgumentsOnNextLine: true +AllowAllArgumentsOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: true AllowBreakBeforeNoexceptSpecifier: Never AllowShortBlocksOnASingleLine: Never From 28043e8305162b11e1c25cb1b675131178791ac9 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 19:15:20 -0300 Subject: [PATCH 06/17] [clang-format] Change SpacesBeforeTrailingComments=1 --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index eaf54634e..84d1f8c61 100644 --- a/.clang-format +++ b/.clang-format @@ -204,7 +204,7 @@ SpaceBeforeParensOptions: SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: true -SpacesBeforeTrailingComments: 2 +SpacesBeforeTrailingComments: 1 SpacesInAngles: Never SpacesInContainerLiterals: false SpacesInLineCommentPrefix: From 17bb11fc4227e46fea4af7dcafb3c380b8fa3d64 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 19:20:05 -0300 Subject: [PATCH 07/17] [clang-format] Change SpaceInEmptyBlock=false I love { } for empty blocks, but it looks like {} is too common among developers now. --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 84d1f8c61..029eed94b 100644 --- a/.clang-format +++ b/.clang-format @@ -203,7 +203,7 @@ SpaceBeforeParensOptions: BeforeNonEmptyParentheses: false SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false -SpaceInEmptyBlock: true +SpaceInEmptyBlock: false SpacesBeforeTrailingComments: 1 SpacesInAngles: Never SpacesInContainerLiterals: false From 1447e829f7ab50452cacbe9db31853cd06111324 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 19:29:01 -0300 Subject: [PATCH 08/17] [clang-format] Change AllowAllParametersOfDeclarationOnNextLine=false With this we prefer to format a function declaration as: int function(arg1, arg2, arg3); Rather than: int function( arg1, arg2, arg3); Cons: This makes the definition of NewParams structures a bit worse. --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 029eed94b..ce34d3aef 100644 --- a/.clang-format +++ b/.clang-format @@ -56,7 +56,7 @@ AlignTrailingComments: Kind: Always OverEmptyLines: 0 AllowAllArgumentsOnNextLine: false -AllowAllParametersOfDeclarationOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false AllowBreakBeforeNoexceptSpecifier: Never AllowShortBlocksOnASingleLine: Never AllowShortCaseExpressionOnASingleLine: true From 4a9ccf27b4554ffffa15457b37911bd204905022 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 19:42:21 -0300 Subject: [PATCH 09/17] [clang-format] Set ReflowComments=1 to allow adjusting comments Allows to format the code in better ways adjusting the comments to fit the column limit. In few cases the comment will require to be moved to other place (e.g. at the top of a statement rather than to the side of it). --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index ce34d3aef..c5facee6d 100644 --- a/.clang-format +++ b/.clang-format @@ -168,7 +168,7 @@ PointerAlignment: Left PPIndentWidth: -1 QualifierAlignment: Leave ReferenceAlignment: Pointer -ReflowComments: false +ReflowComments: true RemoveBracesLLVM: false RemoveParentheses: Leave RemoveSemicolon: false From d38565f64e4c0304b8ea2ae060c9e1c11ba5a863 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 19:54:49 -0300 Subject: [PATCH 10/17] [clang-format] Set SeparateDefinitionBlocks=Always With the current code it makes no difference, but it will force new definitions to be in its own block, e.g. we cannot define two functions without a blank line between then. --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index c5facee6d..b8759eac9 100644 --- a/.clang-format +++ b/.clang-format @@ -174,7 +174,7 @@ RemoveParentheses: Leave RemoveSemicolon: false RequiresClausePosition: OwnLine RequiresExpressionIndentation: OuterScope -SeparateDefinitionBlocks: Leave +SeparateDefinitionBlocks: Always ShortNamespaceLines: 1 SkipMacroDefinitionBody: false SortIncludes: CaseSensitive From f19cbe8a3738c14e6cb9ac4ada62ded03c06a290 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 20:02:36 -0300 Subject: [PATCH 11/17] [clang-format] Set AllowShortCaseLabelsOnASingleLine=true Allows "case value: stmt; break;" in one line if it's short enough. --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index b8759eac9..dd31f8c92 100644 --- a/.clang-format +++ b/.clang-format @@ -60,7 +60,7 @@ AllowAllParametersOfDeclarationOnNextLine: false AllowBreakBeforeNoexceptSpecifier: Never AllowShortBlocksOnASingleLine: Never AllowShortCaseExpressionOnASingleLine: true -AllowShortCaseLabelsOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: true AllowShortCompoundRequirementOnASingleLine: true AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: InlineOnly From 70ec2d422f4ab279fb07fdb3817e6f2fc9c9879b Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 20:13:40 -0300 Subject: [PATCH 12/17] [clang-format] Enable the alignment of short "case: break;" statements --- .clang-format | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.clang-format b/.clang-format index dd31f8c92..9cea58377 100644 --- a/.clang-format +++ b/.clang-format @@ -31,11 +31,11 @@ AlignConsecutiveMacros: Enabled: true PadOperators: true AlignConsecutiveShortCaseStatements: - AcrossComments: false - AcrossEmptyLines: false - AlignCaseArrows: false + AcrossComments: true + AcrossEmptyLines: true + AlignCaseArrows: true AlignCaseColons: false - Enabled: false + Enabled: true AlignConsecutiveTableGenCondOperatorColons: AcrossComments: false AcrossEmptyLines: false From b146f0648e407bc82ab322bac67e275a13261ee0 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 21:53:22 -0300 Subject: [PATCH 13/17] [clang-format] Set PackConstructorInitializers=CurrentLine We prefer two kinds of formatting for constructors: Ctor() : a(), b() {} Ctor() : aaa() , bbb() , ccc() --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 9cea58377..691766be0 100644 --- a/.clang-format +++ b/.clang-format @@ -152,7 +152,7 @@ ObjCBlockIndentWidth: 2 ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true -PackConstructorInitializers: BinPack +PackConstructorInitializers: CurrentLine PenaltyBreakAssignment: 50 PenaltyBreakBeforeFirstCallParameter: 2 PenaltyBreakComment: 30 From 6555e74d83c29f72803f69a504103273ee599e62 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 12 Dec 2024 22:16:55 -0300 Subject: [PATCH 14/17] [clang-format] We use west const (might fix #4361) --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 691766be0..8613b8cae 100644 --- a/.clang-format +++ b/.clang-format @@ -166,7 +166,7 @@ PenaltyIndentedWhitespace: 0 PenaltyReturnTypeOnItsOwnLine: 200 PointerAlignment: Left PPIndentWidth: -1 -QualifierAlignment: Leave +QualifierAlignment: Left ReferenceAlignment: Pointer ReflowComments: true RemoveBracesLLVM: false From d0dbc78f1c5d62cee2e18494f8b9eef1efd219d2 Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 13 Dec 2024 19:59:24 -0300 Subject: [PATCH 15/17] Revert "[clang-format] Set SeparateDefinitionBlocks=Always" This reverts commit d38565f64e4c0304b8ea2ae060c9e1c11ba5a863. It added blank lines between one line member function definitions inside class bodies/header files, something which is undesirable. --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 8613b8cae..8ee57280b 100644 --- a/.clang-format +++ b/.clang-format @@ -174,7 +174,7 @@ RemoveParentheses: Leave RemoveSemicolon: false RequiresClausePosition: OwnLine RequiresExpressionIndentation: OuterScope -SeparateDefinitionBlocks: Always +SeparateDefinitionBlocks: Leave ShortNamespaceLines: 1 SkipMacroDefinitionBody: false SortIncludes: CaseSensitive From d8fdc22648365e46a1acef3449a423aa4a3cae85 Mon Sep 17 00:00:00 2001 From: David Capello Date: Sat, 14 Dec 2024 00:07:23 -0300 Subject: [PATCH 16/17] [precommit] Add .m and .mm files to clang-format --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04fb12181..828ad5173 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: rev: v19.1.5 hooks: - id: clang-format - files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx)$ + files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm)$ types_or: [text] - repo: https://github.com/pocc/pre-commit-hooks From 4b3ff3369ed5b7e9726020ddb4a136594ac33514 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 16 Dec 2024 09:52:55 -0300 Subject: [PATCH 17/17] Update laf module --- laf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laf b/laf index 151733fbf..10d96af44 160000 --- a/laf +++ b/laf @@ -1 +1 @@ -Subproject commit 151733fbf88511f263581e00d8d08d0e8b32844b +Subproject commit 10d96af44f5d64af3fb277f48fdc0dd8cc950ac6