From 6e68cab44d9cb309b4e97edd3ec49c1cd7d410f2 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Thu, 26 Mar 2026 17:41:23 +0100 Subject: [PATCH 1/3] Set clang-format ObjCBlockIndentWidth to 4 There's not currently any Objective C code in the tree, but if any ever shows up it should be indented in a way to match the C++ code. I should have set this to four in the initial commit of the .clang-format file, but I missed it. This doesn't cause any actual formatting changes currently. --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index cd688cbe6..db90b0e08 100644 --- a/.clang-format +++ b/.clang-format @@ -204,7 +204,7 @@ MainIncludeChar: Quote MaxEmptyLinesToKeep: 1 NamespaceIndentation: All ObjCBinPackProtocolList: Auto -ObjCBlockIndentWidth: 2 +ObjCBlockIndentWidth: 4 ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true From 593cabfb330470d4a34ec6f8302b0342117f13c4 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Thu, 26 Mar 2026 17:50:52 +0100 Subject: [PATCH 2/3] Make .clang-format itself use a consistent style for spaces after ':' Some rules used 1 space after ':', some used multiple. Some tried to line up values vertically, some didn't. Make the file consistently use 1 space after ':' everywhere. --- .clang-format | 154 +++++++++++++++++++++++++------------------------- 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/.clang-format b/.clang-format index db90b0e08..1002a7a71 100644 --- a/.clang-format +++ b/.clang-format @@ -1,75 +1,75 @@ --- -Language: Cpp +Language: Cpp AccessModifierOffset: -4 AlignAfterOpenBracket: Align AlignArrayOfStructures: None AlignConsecutiveAssignments: - Enabled: false + Enabled: false AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false + AcrossComments: false + AlignCompound: false AlignFunctionDeclarations: true AlignFunctionPointers: false - PadOperators: true + PadOperators: true AlignConsecutiveBitFields: - Enabled: false + Enabled: false AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false + AcrossComments: false + AlignCompound: false AlignFunctionDeclarations: true AlignFunctionPointers: false - PadOperators: true + PadOperators: true AlignConsecutiveDeclarations: - Enabled: false + Enabled: false AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false + AcrossComments: false + AlignCompound: false AlignFunctionDeclarations: true AlignFunctionPointers: false - PadOperators: true + PadOperators: true AlignConsecutiveMacros: - Enabled: false + Enabled: false AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false + AcrossComments: false + AlignCompound: false AlignFunctionDeclarations: true AlignFunctionPointers: false - PadOperators: true + PadOperators: true AlignConsecutiveShortCaseStatements: - Enabled: false + Enabled: false AcrossEmptyLines: false - AcrossComments: false + AcrossComments: false AlignCaseArrows: false AlignCaseColons: false AlignConsecutiveTableGenBreakingDAGArgColons: - Enabled: false + Enabled: false AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false + AcrossComments: false + AlignCompound: false AlignFunctionDeclarations: false AlignFunctionPointers: false - PadOperators: false + PadOperators: false AlignConsecutiveTableGenCondOperatorColons: - Enabled: false + Enabled: false AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false + AcrossComments: false + AlignCompound: false AlignFunctionDeclarations: false AlignFunctionPointers: false - PadOperators: false + PadOperators: false AlignConsecutiveTableGenDefinitionColons: - Enabled: false + Enabled: false AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false + AcrossComments: false + AlignCompound: false AlignFunctionDeclarations: false AlignFunctionPointers: false - PadOperators: false + PadOperators: false AlignEscapedNewlines: Left -AlignOperands: Align +AlignOperands: Align AlignTrailingComments: - Kind: Always - OverEmptyLines: 0 + Kind: Always + OverEmptyLines: 0 AllowAllArgumentsOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false AllowBreakBeforeNoexceptSpecifier: Never @@ -91,21 +91,21 @@ BinPackParameters: OnePerLine BitFieldColonSpacing: Both BracedInitializerIndentWidth: -1 BraceWrapping: - AfterCaseLabel: true - AfterClass: true + AfterCaseLabel: true + AfterClass: true AfterControlStatement: Always - AfterEnum: true + AfterEnum: true AfterExternBlock: true - AfterFunction: true - AfterNamespace: true + AfterFunction: true + AfterNamespace: true AfterObjCDeclaration: false - AfterStruct: true - AfterUnion: true - BeforeCatch: true - BeforeElse: true + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true BeforeLambdaBody: true - BeforeWhile: false - IndentBraces: false + BeforeWhile: false + IndentBraces: false SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true @@ -113,7 +113,7 @@ BreakAdjacentStringLiterals: true BreakAfterAttributes: Leave BreakAfterJavaFieldAnnotations: false BreakAfterReturnType: None -BreakArrays: true +BreakArrays: true BreakBeforeBinaryOperators: NonAssignment BreakBeforeConceptDeclarations: Always BreakBeforeBraces: Custom @@ -126,20 +126,20 @@ BreakFunctionDefinitionParameters: false BreakInheritanceList: AfterColon BreakStringLiterals: true BreakTemplateDeclarations: Yes -ColumnLimit: 135 -CommentPragmas: '^ IWYU pragma:' +ColumnLimit: 135 +CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: false -DisableFormat: false +DisableFormat: false EmptyLineAfterAccessModifier: Never EmptyLineBeforeAccessModifier: Always EnumTrailingComma: Leave ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true -IncludeBlocks: Regroup +IncludeBlocks: Regroup IncludeCategories: - Regex: '^\"(.+)\"$' Priority: 1 @@ -177,29 +177,29 @@ IndentExternBlock: Indent IndentGotoLabels: true IndentPPDirectives: BeforeHash IndentRequiresClause: true -IndentWidth: 4 +IndentWidth: 4 IndentWrappedFunctionNames: true -InsertBraces: false +InsertBraces: false InsertNewlineAtEOF: true InsertTrailingCommas: None IntegerLiteralSeparator: - Binary: 0 + Binary: 0 BinaryMinDigits: 0 - Decimal: 0 + Decimal: 0 DecimalMinDigits: 0 - Hex: 0 - HexMinDigits: 0 + Hex: 0 + HexMinDigits: 0 JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLines: - AtEndOfFile: false - AtStartOfBlock: false - AtStartOfFile: false -KeepFormFeed: false + AtEndOfFile: false + AtStartOfBlock: false + AtStartOfFile: false +KeepFormFeed: false LambdaBodyIndentation: Signature -LineEnding: LF +LineEnding: LF MacroBlockBegin: '' -MacroBlockEnd: '' +MacroBlockEnd: '' MainIncludeChar: Quote MaxEmptyLinesToKeep: 1 NamespaceIndentation: All @@ -223,7 +223,7 @@ PenaltyExcessCharacter: 5 PenaltyIndentedWhitespace: 1 PenaltyReturnTypeOnItsOwnLine: 500 PointerAlignment: Left -PPIndentWidth: -1 +PPIndentWidth: -1 QualifierAlignment: Custom QualifierOrder: - static @@ -233,7 +233,7 @@ QualifierOrder: - volatile - type ReferenceAlignment: Pointer -ReflowComments: Never +ReflowComments: Never RemoveBracesLLVM: false RemoveEmptyLinesInUnwrappedLines: false RemoveParentheses: Leave @@ -244,8 +244,8 @@ SeparateDefinitionBlocks: Leave ShortNamespaceLines: 1 SkipMacroDefinitionBody: false SortIncludes: - Enabled: true - IgnoreCase: false + Enabled: true + IgnoreCase: false SortJavaStaticImport: Before SortUsingDeclarations: LexicographicNumeric SpaceAfterCStyleCast: false @@ -265,8 +265,8 @@ SpaceBeforeParensOptions: AfterForeachMacros: true AfterFunctionDefinitionName: false AfterFunctionDeclarationName: false - AfterIfMacros: true - AfterNot: false + AfterIfMacros: true + AfterNot: false AfterOverloadedOperator: false AfterPlacementOperator: true AfterRequiresInClause: false @@ -276,23 +276,23 @@ SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false SpacesBeforeTrailingComments: 1 -SpacesInAngles: Never +SpacesInAngles: Never SpacesInContainerLiterals: false SpacesInLineCommentPrefix: - Minimum: 1 - Maximum: -1 -SpacesInParens: Never + Minimum: 1 + Maximum: -1 +SpacesInParens: Never SpacesInParensOptions: ExceptDoubleParentheses: false - InCStyleCasts: false + InCStyleCasts: false InConditionalStatements: false InEmptyParentheses: false - Other: false + Other: false SpacesInSquareBrackets: false -Standard: c++20 +Standard: c++20 TableGenBreakInsideDAGArg: DontBreak -TabWidth: 4 -UseTab: Never +TabWidth: 4 +UseTab: Never VerilogBreakBetweenInstancePorts: true WrapNamespaceBodyWithEmptyLines: Never ... From b7c66a7ac592d801e76660d70e9b9b5333e99855 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Thu, 26 Mar 2026 18:20:52 +0100 Subject: [PATCH 3/3] Remove TableGen options from .clang-format These options are for a LLVM internal format, not relevant to C++ code and they are conditionally supported based on clang-format build options, so some builds may support them, some builds will not. Also, old clang-format versions may error on encountering an unknown option while newer versions may just ignore them. In any case, these do nothing for us and they may cause problems for some users, so just remove them. --- .clang-format | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/.clang-format b/.clang-format index 1002a7a71..a797a282f 100644 --- a/.clang-format +++ b/.clang-format @@ -41,30 +41,6 @@ AlignConsecutiveShortCaseStatements: AcrossComments: false AlignCaseArrows: false AlignCaseColons: false -AlignConsecutiveTableGenBreakingDAGArgColons: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionDeclarations: false - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveTableGenCondOperatorColons: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionDeclarations: false - AlignFunctionPointers: false - PadOperators: false -AlignConsecutiveTableGenDefinitionColons: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false - AlignFunctionDeclarations: false - AlignFunctionPointers: false - PadOperators: false AlignEscapedNewlines: Left AlignOperands: Align AlignTrailingComments: @@ -290,7 +266,6 @@ SpacesInParensOptions: Other: false SpacesInSquareBrackets: false Standard: c++20 -TableGenBreakInsideDAGArg: DontBreak TabWidth: 4 UseTab: Never VerilogBreakBetweenInstancePorts: true